What is wrong in line 6? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is wrong in line 6?

weight=int(input()) height=float(input()) BMI=(weight/(height**2)) if BMI<18.5: print("Underweight") elif ( BMI > 18.5 and BMI < 25 ): print("Noraml") elif (25=<BMI and BMI<30): print("Overweight") elif BMI>=30 print("Obesity")

22nd Aug 2021, 2:25 PM
Moumn Almunawy
Moumn Almunawy - avatar
7 Answers
+ 6
Hi Moumn! As others suggested, there are more errors(wrong syntax, indentation error and typo) found in your code. Here it is your working code. weight=int(input()) height=float(input()) BMI=(weight/(height**2)) if BMI<18.5: print("Underweight") elif ( BMI >= 18.5 and BMI < 25 ): print("Normal") elif (25<=BMI and BMI<30): print("Overweight") elif BMI>=30: print("Obesity")
22nd Aug 2021, 2:40 PM
Python Learner
Python Learner - avatar
+ 5
Moumn Almunawy Wrong syntax. There is no =< there is <=
22nd Aug 2021, 2:27 PM
A͢J
A͢J - avatar
+ 4
I think you have a problem with code indentation. Please indent the code properly, indentation in Python is crucial Here's a tutorial about indentation https://code.sololearn.com/cT5BRIbkia21/?ref=app (Edit) Please tag a relevant programming language next time ... https://code.sololearn.com/W3uiji9X28C1/?ref=app
22nd Aug 2021, 2:29 PM
Ipang
+ 1
I think it will run - weight=int(input()) height=float(input()) BMI=(weight/(height**2)) if BMI<18.5: print("Underweight") elif ( BMI >= 18.5 and BMI < 25 ): print("Normal") elif (25<=BMI and BMI<30): print("Overweight") elif BMI>=30: print("Obesity")
24th Aug 2021, 9:24 AM
Rohan Paul
Rohan Paul - avatar
+ 1
One improvement that I can suggest is have the weight as FLOAT.😺
24th Aug 2021, 12:49 PM
Sanjay Kamath
Sanjay Kamath - avatar
0
: in
24th Aug 2021, 9:25 AM
Sami Golzadeh
Sami Golzadeh - avatar
0
The line 6 have indentation error, except that, there are more errors. The code should be: weight=int(input()) height=float(input()) BMI=(weight/(height**2)) if BMI<18.5: print("Underweight") elif BMI > 18.5 and BMI < 25: print("Noraml") elif 25 <= BMI and BMI < 30 : print("Overweight") elif BMI >= 30: print("Obesity")
24th Aug 2021, 12:43 PM
THE A.R.B.
THE A.R.B. - avatar