Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2f0ab9b commit 3c30f91Copy full SHA for 3c30f91
Work/bounce.py
@@ -1,3 +1,16 @@
1
# bounce.py
2
#
3
# Exercise 1.5
4
+'''
5
+A rubber ball is dropped from a height of 100 meters and each time it hits the ground, it bounces back up to 3/5 the height it fell.
6
+Write a program bounce.py that prints a table showing the height of the first 10 bounces.
7
8
+
9
+height = 100 # meters
10
+bounceBack = 0.6 # 3/5 meters
11
+bounce = 1
12
13
+while bounce <= 10:
14
+ height = height * bounceBack
15
+ print(bounce, round(height, 4))
16
+ bounce += 1
0 commit comments