+ 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")
7 odpowiedzi
+ 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")
+ 5
Moumn Almunawy
Wrong syntax. There is no =< there is <=
+ 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
+ 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")
+ 1
One improvement that I can suggest is have the weight as FLOAT.😺
0
: in
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")