1.2 KiB
1.2 KiB
id, source_exercise_id, title, section, source_path, source_repo, source_commit, student_visible_solution, has_private_solution, skip
| id | source_exercise_id | title | section | source_path | source_repo | source_commit | student_visible_solution | has_private_solution | skip |
|---|---|---|---|---|---|---|---|---|---|
| practical-python-1.5 | 1.5 | The Bouncing Ball | 1.2 A First Program | 01_Introduction/02_Hello_world.md | https://github.com/dabeaz-course/practical-python | 93dca856b41c61a0a0f85ae334116e4c125629ea | false | true | false |
Exercise 1.5: The Bouncing Ball
Source: Practical Python Programming,
01_Introduction/02_Hello_world.md.
Exercise 1.5: The Bouncing Ball
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. Write
a program bounce.py that prints a table showing the height of the
first 10 bounces.
Your program should make a table that looks something like this:
1 60.0
2 36.0
3 21.599999999999998
4 12.959999999999999
5 7.775999999999999
6 4.6655999999999995
7 2.7993599999999996
8 1.6796159999999998
9 1.0077695999999998
10 0.6046617599999998
Note: You can clean up the output a bit if you use the round() function. Try using it to round the output to 4 digits.
1 60.0
2 36.0
3 21.6
4 12.96
5 7.776
6 4.6656
7 2.7994
8 1.6796
9 1.0078
10 0.6047