赞
踩
身体质量指数,是BMI(Body Mass Index)指数,简称体质指数,是国际上常用的衡量人体胖瘦程度以及是否健康的一个标准。
计算公式为:BMI=体重÷身高²。(体重单位:千克;身高单位:米。)
BMI由19世纪中期的比利时通才凯特勒最先提出。
- height,weight = eval(input("请输入身高(米)和体重(公斤)[逗号隔开]:"))
- bmi = weight / pow(height , 2)
- print("BMI数值为:{:.2f}".format(bmi))
- who , nat = " "," "
- if bmi < 18.5:
- who , nat = "偏瘦","偏瘦"
- elif bmi >= 18.5 and bmi < 24:
- who , nat = "正常","正常"
- elif bmi >=24 and bmi <25:
- who , nat = "正常","偏胖"
- elif bmi >=25 and bmi <28:
- who , nat = "偏胖","偏胖"
- elif bmi >=28 and bmi <30:
- who , nat = "偏胖","肥胖"
- elif bmi >=30:
- who , nat = "肥胖","肥胖"
- print("BMI指标为: 国际{0},国内{1}".format(who,nat))
输出结果:
- 请输入身高(米)和体重(公斤)[逗号隔开]:1.72,70
- BMI数值为:23.66
- BMI指标为: 国际正常,国内正常
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。