Python problem in BMI [solved] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

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

27th Sep 2021, 2:01 AM
Lz1234
7 Answers
+ 5
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.
27th Sep 2021, 2:16 AM
Python Learner
Python Learner - avatar
+ 2
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".
27th Sep 2021, 3:06 AM
Simon Sauter
Simon Sauter - avatar
0
Thanks
27th Sep 2021, 4:55 AM
Lz1234
0
Mia Read the other answers thay already found the problom
27th Sep 2021, 2:51 PM
Lz1234
0
My mistake. Thanks
27th Sep 2021, 4:06 PM
Mia
0
No problom
27th Sep 2021, 5:01 PM
Lz1234
- 1
This code doesn't work. I tried.
27th Sep 2021, 9:17 AM
Mia