Original title:
Ball free fall from a height of 100 meters, the anti-jump back after each landing half its original height; down again, find it at the 10th floor, after a total of how many meters? 10th rebound tall?
My source:
# ! / Usr / bin / Python # encoding = UTF. 8- # - * - Coding: UTF-. 8 - * - # a ball free fall from a height of 100 meters, after each jump back half of the original anti-fall height; then fall , find it at the 10th floor, after a total of how many meters? 10th rebound tall? X = int (INPUT ( " Please INPUT The nuber: \ n- " )) # selected number Y = 100 # Total rebound distance S S = 100 # calculate S for I in Range (. 1, X +. 1 ): S = S + * 100 (0.5 ** I) * 2 # x-th rebound height H; H = 100 * (0.5 ** x) Print (H, S)
Can be found, x greater the input, s closely approximates 300, but still less than 300;
result:
The original title given answers:
-------- (I am dividing line) --------
reference:
1. RUNOOB.COM:https://www.runoob.com/python/python-exercise-example20.html
Remarks:
Initial modified: October 3, 2019 13:14:03
Environment: Windows 7 / Python 3.7.2