用python实现BMI的计算

用python实现BMI的计算,第1张

def fun_bmi_upgrade(*person):
    for list_person in person:
        for item in list_person:
            person = item[0]
            #姓名
            height = item[1]
            #身高(単位:米)
            weight = item[2]
#体重(単位:千克)
            print("\n" +"="*13,person,'='*13)
            print("身高: " + str(height) + "米\t体重: " + str(weight) + "千克")
            bmi=weight/(height*height)#用于汁算BMI指数,公式匁: BME=体重/ 身高的平方
            print("BMI指数: "+str(bmi)) # 輸出BMI指数
#判断身材是否合理
            if bmi<18.5:
                print("惣的体重辻軽~@ _@")
            if bmi>=18.5 and bmi<24.9:
                print(" 正常范囿,注意保持(-_ -)")
            if bmi>24.9 and bmi<29.9:
                print(" 悠的体重辻重~@ _@~")
            if bmi>29.9:
                print("肥胖^@ @^")

list_w= [('猗梦',1.70,65),('零咨',1.78,50),('黛当',1.72,66)]
list_m= [('梓軒',1.80,75),('冷伊-',1.75,70)]
fun_bmi_upgrade(list_w,list_m)

 

 函数调用

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/787732.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-05
下一篇 2022-05-05

发表评论

登录后才能评论

评论列表(0条)

保存