+ 4

What’s wrong with my code?

Trying to solve the BMI calculator project in Python, here is my try. Anyone that can tell me what’s wrong? h= float(input("Enter your height")) w= float(input("Enter your weight")) bmi= w/(h**2) if bmi < 18.5: print("Underweight") elif bmi >= 18.5 and < 25: print("Normal") elif bmi >= 25 and < 30: print("Overweight"): else: print("Obesity") It says syntax error line 9 if that helps

19th May 2021, 11:40 PM
Jocelyn
Jocelyn - avatar
1 Answer
+ 3
In Python you can't say if a > x and < y You have to say either if a > x and a < y or if y > a > x
20th May 2021, 5:26 AM
David Ashton
David Ashton - avatar