Calculator BMI | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Calculator BMI

writes that the syntax is incorrect on line 6, what is the error? i = int (input()) z = float (input()) iz = i/z**2 if iz <18.5: print ("Underweight") elif iz >= 18.5 and <25: print("Normal"), elif iz >= 25 and i/z <30: print ("Overweight") else: print ("Obesity")

22nd Apr 2022, 11:23 PM
Клеш Рояль
Клеш Рояль - avatar
2 Answers
+ 2
elif iz >= 18.5 and ?<25: #iz was missing at ?. as William Owens stated it is guarenteed iz>=18.5 so no need to ask again.
22nd Apr 2022, 11:32 PM
John Wells
John Wells - avatar
0
You dont have to test if it is between the values, remember the if will stop at the first true statement if condition: do this stuff elif condition: do this stuff else: if all above are false do this stuff
22nd Apr 2022, 11:28 PM
William Owens
William Owens - avatar