码迷,mamicode.com
首页 > 编程语言 > 详细

python--BMI

时间:2019-10-20 13:16:56      阅读:105      评论:0      收藏:0      [点我收藏+]

标签:input   输入   style   身高   指标   col   form   code   eva   

#bmi
height,weight = eval(input("请输入身高(m) 体重(kg),以逗号隔开\n"))
bmi = weight/pow(weight,2)
print("BMI数值为:{:.2f}".format(bmi))
who,nat = "",""                     #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))

 

python--BMI

标签:input   输入   style   身高   指标   col   form   code   eva   

原文地址:https://www.cnblogs.com/xdd1997/p/11707150.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!