Why isn’t this working? (I’m doing bmi calculator(python)) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why isn’t this working? (I’m doing bmi calculator(python))

It just says “line 9 invalid syntax” weight = (int(input())) height = (float(input())) x = weight / height ** 2 if x < 18.5: print ("Underweight") elif x >= 18.5 and x < 25: print ("Normal") elif x >= 25 and x < 30: print ("Overweight") else print ("Obesity")

3rd Dec 2021, 7:21 PM
Rimchi
Rimchi - avatar
1 Answer
+ 2
Rimchi The elif lines are wrongly indented. They should be at the same indentation as the original if statement.
3rd Dec 2021, 8:45 PM
Brian
Brian - avatar