+ 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')
7 odpowiedzi
+ 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")
+ 3
It worked thanks.
+ 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")
+ 2
I changed it but still thereis problem saying
Syntax error : invalid syntax
On the 2nd line ((from last))
+ 2
Please can you help me in question no. 2.2
+ 1
Just found..
Already updated..
Use elif x>=30 :
Instead of else x>=30 :
Else don't need condition. Just need
else :
#code
+ 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")