身体质量指数BMI

浪尽此生 提交于 2019-11-27 02:57:43

思路方法:难点在于同时输出国内和国际回应的的分类

#CalBMI.py;
height,weight = eval(input("请输入身高(米)和体重(公斤)【逗号隔开】:"))
bmi = weight / pow(height,2)
print("BMI的值为:{:.2f}".format(bmi))
who,nat = "",""
if bmi<18.5:
    who,nat = "偏瘦","偏瘦"
elif 18.5<=bmi<24:
    who,nat = "正常","正常"
elif 24<=bmi<25:
    who,nat = "正常","偏胖"
elif 25<=bmi<28:
    who,nat = "偏胖","偏胖"
elif 28<=bmi<30:
    who,nat = "偏胖","肥胖"  
else:
    who,nat = "肥胖","肥胖"
print("BMI指标为:国际'{0}',国内'{1}'".format(who,nat))
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!