第一天--簡單使用python-編寫體重指數BMI

height = input('你的身高是多少M:')
height = float(height)
if 0.01<=height<=2.24:
   print()
elif height<=0:
  print("你肯定你是人嗎?")
else:
   exit('請輸入正確的值')
weight =  input('你的體重是多少KG:')
weight = float(weight)
BMI = weight/(height*height)
if BMI >=30:
  print('重度肥胖')
elif  BMI>=27:
  print('肥胖')
elif BMI>=24:
  print('偏胖')
elif BMI>=18.5:
   print('正常')
else:
 print('偏瘦')
相關文章
相關標籤/搜索