栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

用python实现BMI的计算

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

用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)

 

 函数调用

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/839922.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号