python 身体BMI指数判断

3.30 python身体BMI指数判断

代码:

height,weight=eval(input("请输入身高(米)体重(公斤):"))
bim=weight/pow(height,2)
print("BIM指数为:{:.2f}".format(bim)) 
a,b="",""
if bim<18.5:
    a,b="偏瘦","偏瘦"
elif 18.5<=bim<24:
    a,b="正常","正常"
elif 24<=bim<25:
    a,b="正常","偏胖"
elif 25<=bim<28:
    a,b="偏胖","偏胖"
elif 28<=bim<30:
    a,b="偏胖","肥胖"
else:
    a,b="肥胖","肥胖"
print("BMI指标为:国际'{0}',国内’{1}’".format(a,b))

运行结果截图:
python 身体BMI指数判断

上一篇:jquery easyui校验select下拉列表值是否为空的问题


下一篇:raspberrypi 编译 gstreamer 1.3.2