+ 1

What's wrong with my code?

I'm learning Python for begginers and doing the 4th proyect but the output is syntax error, this is the code: W = (int(input())) H = (float(input())) A = W / H**2 if A < 18.5: print("Underweight") else: if (A >=18.5 and <=24.9): print("Normal") else: if (A >=25 and <=29.9): print ("Overweight") else: if (A >= 30): print("Obesity")

20th Jan 2022, 11:49 AM
ZiKeng54
ZiKeng54 - avatar
1 Answer
+ 3
Look at what what the error message says and which line it hints: The condition needs to be (A >= 18.5 and A < 25) and so on. I suggest you to use "elif" instead of "else if" to chaim conditions. Also check the conditions, I think they do not fulfill the task requirements yet
20th Jan 2022, 12:01 PM
Lisa
Lisa - avatar