❶ python bmi公式怎麼用
weight=int(raw_input("請輸入體重(千克):"))
height=int(raw_input("請輸入身高(米):"))
BMI=weight/(height*height)
print "BMI=",BMI
if BMI<19:
print「輕體重"
elif BMI>=19 and BMI<25:
print"健康身體"
elif BMI>=25 and BMI<28:
print"超重「
else:
print"肥胖」
raw_input("press any key to quit.")
❷ 怎麼用python算bmi 簡單編程 在線等
weight=int(raw_input("請輸入體重(千克):"))
height=int(raw_input("請輸入身高(米):"))
BMI=weight/(height*height)
print "BMI=",BMI
if BMI<19:
print「輕體重"
elif BMI>=19 and BMI<25:
print"健康身體"
elif BMI>=25 and BMI<28:
print"超重「
else:
print"肥胖」
raw_input("press any key to quit.")
❸ 怎樣用python計算bmi
weight=int(raw_input("請輸入體重(千克):"))
height=int(raw_input("請輸入身高(米):"))
BMI=weight/(height*height)
print"BMI=",BMIifBMI<19:
print「輕體重"
elifBMI>=19andBMI<25:
print"健康身體"
elifBMI>=25andBMI<28:
print"超重「
else:
print"肥胖」
raw_input("pressanykeytoquit.")
❹ Python讓用戶輸入自己的體重,以克為單位轉化為千克,但是現在我不知道怎麼讓用戶輸入的代碼
defconvert_kg(g):
returnstr(g/1000.0)+'kg'
print(convert_kg(int(input('請輸入體重(克):'))))
python3版本。python2的話中文要用unicode。想學好python可以關注我的課程,謝謝
❺ python重量計算編程
x1=50
y1 = x1 + 0.5*10
y2 = y1 * 0.165