python学习 第五个程序 计算BMI

# CalBMI.py
height, weight = eval(input("请输入身高(米)和体重(千克)[用逗号隔开]:"))
BMI = weight / pow(height, 2)
condition = ""
if BMI < 18.5:
condition = "偏瘦"
elif BMI < 25:
condition = "正常"
elif BMI < 30:
condition = "偏胖"
else:
condition = "肥胖"
print("BMI指数:{}".format(condition))

猜你喜欢

转载自www.cnblogs.com/wumingoo1/p/10320187.html