+ 2

please can someone help me find the errors in this code for a bmi calculator

height=float(input()) weight=int(input()) BMI= weight / height **2 if BMI < 18.5: print('underweight') elif 18.5 <= BMI < 25: print('normal') elif 25 <= BMI < 30: print('overweight') else BMI > 30: print("obesity")

12th Jul 2021, 7:05 PM
Johanan Oppong Amoateng
Johanan Oppong Amoateng - avatar
4 odpowiedzi
12th Jul 2021, 7:27 PM
JaScript
JaScript - avatar
+ 2
Python is case-sensitive. If the question asks for Normal but gets normal, it will be marked wrong.
13th Jul 2021, 3:03 AM
David Ashton
David Ashton - avatar
+ 1
if bmi < 18.5: print("Underweight") if bmi >= 18.5 and bmi < 25.0: print("Normal") if bmi >= 25.0 and bmi < 30.0: print("Overweight") if bmi >= 30.0: print("Obesity") Use separate if and statements and link the conditions with the and operator
12th Jul 2021, 7:28 PM
Stewie
Stewie - avatar
+ 1
Put the height ** 2 in brackets: (height ** 2)
12th Jul 2021, 7:29 PM
Yahel
Yahel - avatar