Python problem in BMI [solved] | Sololearn: Learn to code for FREE!


Python problem in BMI [solved]

Code not working if any one can help me BMI weight = str(input()) hight = float(input()) bmi = weight/(hight * hight) if bmi < 18.5: print ('Underweight') elif bmi >= 18.5 and bmi < 25: print ('Normal') elif bmi >= 25 and bmi < 30: print ('overweight') elif bmi > 30: print ('Obesity')

9/27/2021 2:01:21 AM


7 Answers

New Answer


Hi Lz1234! str() is used to return the string. But you can't use strings for arithmetic operations. For that, you can use int() or float() for weight variable to convert it to an integer or float.


Apart from what was already mentioned, to pass the test cases it has to be "Overweight" instead of "overweight" and the last condition has to be ">=30" instead of ">30".




Mia Read the other answers thay already found the problom


My mistake. Thanks


No problom


This code doesn't work. I tried.