工程與科技
大學
已解決
第3 16 17條完全不知道要打什麼
用while true算BMI能算完一組數據再直接算下一組不用重跑嗎?
有既定的數據要用if設range嗎?
Python初學真的問題很多抱歉(;´༎ຶД༎ຶ`)
3
4
600 v0u - W NE
while True:
try:
height, weight = input("height, weight:").split("")
height = float("height")
weight = float("weight")
bmi = weight/((height/100)**2)
if bmi <= 18.5 :
print("underweight")
elif 18.5 < bmi <= 25 :
print("normal weight")
elif 25 < bmi <= 30 :
print("overweight")
elif 30 < bmi :
print("obese")
10
11
12
13
14
15
16
except:
exit(print())
17
18
19
20
I
解答
您的問題解決了嗎?
看了這個問題的人
也有瀏覽這些問題喔😉
推薦筆記
【工程數學】『一階ODE』 完成
141
2
材料工程科學讀書筆記
127
0
工程數學CH1
126
15
計算機程式-Part 1
107
0
材料力學-應力和剪力
97
1
工程材料
69
1
Python 01 - 變數與資料型態
65
1
轉型的部分打錯了,float(height)才對,用“”包起來會變成把"height"這個字串轉成浮點數(float)。