Distance Traveled
Source: May 2024, Task 1 (DTU 02002/02003). Study solution — not an official answer key.
Problem
Distance fallen from rest: s = (1/2) * g * t2 with g = 9.81 m/s2.
Write distance_traveled(t) returning the distance in meters.
Example
>>> distance_traveled(5.5)
148.37625
Approach
Plug t into the formula with g = 9.81.
Solution
Show solution Hide solution
Solution
def distance_traveled(t):
g = 9.81
return 0.5 * g * t ** 2