体脂率案例

personHeight =  input("请输入你的身高(m)")
personHeight = float(personHeight)

personWeight = input("请输入你的体重(kg)")
personWeight = float(personWeight)

personAge = input("请输入你的年龄:")
personAge = int(personAge)

personSex = int(input("请输入你的性别(男:1,女:0)"))
personSex = int(personSex)
BMI = personWeight / (personHeight * personHeight)
TZL = 1.2 * BMI + 0.23 * personAge - 5.4 - 10.8 * personSex


minNum = 0.15 + 0.10 * ( 1 - personSex )
maxNum = 0.18 + 0.10 * ( 1 - personSex )

re = minNum <= TZL <= maxNum
print("你的体脂率是:%f" % TZL )
print("你的体脂率是否符合标准",re)

print(minNum,maxNum)
posted @ 2020-05-25 16:03  春天的风情  阅读(254)  评论(0编辑  收藏  举报