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