-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfalling.py
More file actions
25 lines (23 loc) · 1001 Bytes
/
falling.py
File metadata and controls
25 lines (23 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
################################################################################
# Description: Calculates the falling distance from 0 to 10 seconds
###############################################################################
# distance falling calculation
def falling_distance(time):
#seconds = 0.0
gravitational = 9.81 # gravitational force
distance = 0.5 * gravitational * (time ** 2) # d = 1/2 gt^2
return distance
# main
def main():
print("Time (s) Distance (m)\n----------------------")
# print("-------------------------")
for seconds in range(1, 11):
distance_falling = falling_distance(seconds)
#gravitational = 9.81
#distance = 0.5 * gravitational * (time ** 2)
#return distance
print(format(seconds,'8,.0f'), format(distance_falling,'13,.2f'))
# return distance
# Don't edit these 2 lines & make sure they're at the end of your program
if __name__ == '__main__':
main() # calls the main function