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


Why my code is not working


4/11/2021 12:18:01 PM

Akash Prasad

6 Answers

New Answer


Try using float and see if it would work


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


#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')


Now is it ok


Going to my desktop to check


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