python练手_20-高空抛物

# -*- coding:utf-8 -*-
# @Author: CH
"""
@project: python study
@time:
@detail:
@else: DO NOT STOP STUDYING!!!
"""

# 题目 一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下,求它在第10次落地时,共经过多少米?第10次反弹多高?

high=200
total=100
for i in range(10):     #遍历进行计算每次的反跳高度
    high/=2
    total+=high
    print('第{}次落地后反跳高度: '.format(i+1),high/2)
print('总长:',total)

你可能感兴趣的:(python练手_20-高空抛物)