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)

运行结果:

 

posted @ 2024-03-28 09:59  bobo哥  阅读(12)  评论(0编辑  收藏  举报