Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 43f85a0

Browse files
committed
Completed Exercise 1.5: The Bouncing Ball
1 parent 1fca335 commit 43f85a0

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Work/.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Work/bounce.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
# bounce.py
2-
#
3-
# Exercise 1.5
1+
height = 100 # meters
2+
after_bounce_height = 0.6 # Each time ball hits the ground, it bounces back up to 3/5 the height it fell
3+
first_ten_bounces = 10
4+
5+
for bounce in range(1, first_ten_bounces+1):
6+
print(bounce, round(height * after_bounce_height, 4))
7+
height *= after_bounce_height

0 commit comments

Comments
 (0)