Please tell me why it's not working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Please tell me why it's not working?

It's not a big deal for may but I just started learning Python. And I may be missing something But i can't tell what. Plz help. hight=float(input()) waight=int(input()) x=(waight/hight**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 (x>=30): print('Obesity')

18th Jan 2022, 2:49 PM
sefat zunaid
sefat zunaid - avatar
7 Answers
+ 3
Error in flot() float spelling mistake, use float() sefat zunaid and syntax error in else (x>=30): use elif (x>=30): or just else print("Obesity")
18th Jan 2022, 2:51 PM
Jayakrishna 🇮🇳
+ 3
It worked thanks.
18th Jan 2022, 3:00 PM
sefat zunaid
sefat zunaid - avatar
+ 3
height = float(input()) weight = int(input()) val = weight / height ** 2 if val < 18.5: print("Underweight") elif val < 25: print("Normal") elif val < 30: print("Overweight") else: print("Obesity")
19th Jan 2022, 10:28 PM
Azamat Shermatov
Azamat Shermatov - avatar
+ 2
I changed it but still thereis problem saying Syntax error : invalid syntax On the 2nd line ((from last))
18th Jan 2022, 2:56 PM
sefat zunaid
sefat zunaid - avatar
+ 2
Please can you help me in question no. 2.2
18th Jan 2022, 3:26 PM
Prithviraj
+ 1
Just found.. Already updated.. Use elif x>=30 : Instead of else x>=30 : Else don't need condition. Just need else : #code
18th Jan 2022, 2:59 PM
Jayakrishna 🇮🇳
+ 1
weight = int(input()) height = float(input()) if weight / height**2 <18.5: print("Underweight") elif weight / height**2 >=18.5 and weight / height**2 < 25: print("Normal") elif weight / height**2 >=25 and weight / height**2 <30: print("Overweight") elif weight / height**2 >=30 : print("Obesity")
19th Jan 2022, 7:55 PM
Ahmed Seria
Ahmed Seria - avatar