0
Can someone tells me what's the wrong in this code
Bmi =int(input()) Bmi = weight / height**2 if Bmi<18.5 print(Underweight): else: if 18.5=<Bmi<25: print(Normal) else: if 25=<Bmi<30: print(Overweight) else: if Bmi<30 print(Obesity)
4 Antworten
+ 3
Hi! most likely, you do not have enough gaps in the use of branch operators, the third and 12th lines of code lack a colon :
put at least three spaces in front of the print operator
in the fourth line, remove the extra colons: you are very inattentive in writing the code
+ 2
Where is weight and height defined?
+ 2
```
def main():
height = float(input())
weight = float(input())
bmi = (weight / height ** 2)
if (bmi < 18.5):
wclass = ("Underweight")
elif (bmi >= 18.5 and bmi < 25):
wclass = ("Normal weight")
elif (bmi >= 25 and bmi < 30):
wclass = ("Overweight")
elif (bmi > 30):
wclass = ("Obese")
print ("current bmi:", bmi)
print ("weight catagory:", wclass)
main()
```
I have changed the code ever so slightly, it now works. if you have any questions just let me know.
+ 2
Thanks a lot for all🌻