用python实现BMI的计算

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)

 

 函数调用

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值