python 皮球回弹问题
源程序:
height = 80
s = height # 球经过的全部路径长度
t = str(height) + "+"
for i in range(9):
s = s + height
t = t + str(height) + "+"
height = height / 2
print(t.strip("+"), "=", s)
print("第10次:", height)
运行结果:

源程序:
height = 80
s = height # 球经过的全部路径长度
t = str(height) + "+"
for i in range(9):
s = s + height
t = t + str(height) + "+"
height = height / 2
print(t.strip("+"), "=", s)
print("第10次:", height)
运行结果: