print("Please enter your Weight")
weight = input(">")
print("Please enter your height")
height = input(">")
bmi = weight/height
if int(bmi) <= 18:
print("you are currently under weight")
elif int(bmi)>=24:
print("you are normal weight")
else:
print("you are over weight")
回溯不受支持的操作數類型(個),/: 'STR' 和 'STR'
File "C:\Users\reazonsraj\Desktop\123.py", line 6, in <module>
bmi = weight/height
TypeError: unsupported operand type(s) for /: 'str' and 'str'
你輸入一個字符串,然後試圖把它與一個字符串分割,你的輸入轉換爲一個int –
使用'int':'INT(重量)/ INT(高度)' –
順便說一下,這不是你計算BMI的方法。 – JJJ