Why my code is not working | Sololearn: Learn to code for FREE!

+3

Why my code is not working

https://code.sololearn.com/cYE4nMktON8b/?ref=app

4/11/2021 12:18:01 PM

Akash Prasad

6 Answers

New Answer

+4

Try using float and see if it would work

+1

Because you are not printing correct thing. Secondly use float instead of int

+1

#your code goes here weight=float(input('enter weight')) height=float(input('enter height')) BMI=weight/height**2 if BMI<18.5: print('Underweight') elif BMI>=18.5 and BMI<25: print('Normal') elif BMI>=25 and BMI<30: print('Overweight') else: print('Obesity')

+1

Now is it ok

+1

Going to my desktop to check

+1

Bro, your code is close to being a solution but you are making some silly mistakes. I have removed those mistakes in your code and commented your errors. Here is the solution that works. weight=float(input()) #remove strings inside input height=float(input()) #remove strings inside input BMI=weight/height**2 if BMI<18.5: print('Underweight') #underweight is not same as Underweight elif BMI>=18.5 and BMI<25: print ('Normal') #normal is not same as Normal elif BMI>=25 and BMI<30: print('Overweight') #overweight is not same as Overweight else: print('Obesity') #obesity is not same as Obesity