"""根據身高、體重計算BMI指數(改進版)""" height = float(input("請輸入您的身高:")) #輸入身高,單位:米 weight = float(input("請輸入您的體重:")) #輸入體重,單位:千克 bmi = weight/(height*height) #用於計算BMI指數,公式:BMI=體重/身高的平方 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("肥胖 ^@_@^")
學號:2020310143012
昵稱:苒若