This Python program reads the fall time from the user and calculates the falling distance at each second using the formula:
distance = ½ × g × t²
The gravitational acceleration g is set to 9.8 m/s².
def falling_distance(g: float, t: int) -> float:
return 0.5 * g * t**2
# Read fall time from user
max_time = int(input("Enter fall time (in seconds): "))
g = 9.8 # gravity acceleration
print("Falling distance at each second:")
for t in range(0, max_time + 1):
d = falling_distance(g, t)
print(f"t = {t} sec → distance = {d:.2f} meters")
t = 0 sec → distance = 0.00 meters
t = 1 sec → distance = 4.90 meters
t = 2 sec → distance = 19.60 meters
t = 3 sec → distance = 44.10 meters
t = 4 sec → distance = 78.40 meters
t = 5 sec → distance = 122.50 meters