The distance for a marathon is 26 mi 385 yd. In 1984, Joan Benoit set an Olympic record with a time of 2 h 24 min 52 s.
What was her average speed in m/s?
Distance $s = 26$ mi $385$ yd
Time $t = 2$ h $24$ min $52$ s
By mean of introduction, we will use the unit conversion modules Pint
# See if the library module "pint" is installed, if not download and install it
# pint is not installed by default in anaconda
#
# if you want to install in anaconda use this command in the anaconda console:
# conda install -c conda-forge pint
#
# if you do not use anaconda this script will install pint by the operating system
#
try:
import pint
except:
import os
os.system('pip install pint')
import pint
from datetime import timedelta
u = pint.UnitRegistry()
Time = timedelta(hours=2, minutes=24, seconds=52)
Distance = 26 * u.mile + 385 * u.yd # in m
Speed = Distance.to(u.m) / (Time.total_seconds() * u.s)
print(f'His average speed was {Speed:.1f} . (or {Speed.to(u.km / u.hour):.1f}).')