国际国内BMI

image.png

用程序判断国际国内BMI:
height,weight=eval(input("please input your body height(m) and weight(kg)[splited by ',']:"))
BMI=weight/(height**2)
print("your BMI is :{:.2f}".format(BMI))
who,nat="",""
if 18.5>BMI:
who,nat="thin","thin"
elif 24>BMI>=18.5:
who,nat="normal","normal"
elif 25>=BMI>=24:
who,nat="normal","a little fat"
elif 28>BMI>=25:
who,nat="a little fat","a little fat"
elif 28>=BMI>25:
who,nat="a little fat","very fat"
elif BMI>=30:
who,nat="very fat","very fat"
print("international BMI is '{0}',national BMI is '{1}' !".format(who,nat))

output result:
please input your body height(m) and weight(kg)[splited by ',']:1.74,74
your BMI is :24.44
international BMI is 'normal',national BMI is 'a little fat' !

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。