Calculate BIM | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Calculate BIM

hello i tried this programm to calculate BIM but i doesnt work in sololearn but in VCS it works : Weight = 85 height = 1.9 BMI = Weight / (height*height) while True : if BMI < 18.5 : print('underweight') elif BMI <25 : print('Normal') elif BMI < 30 : print('Overweight') elif BMI >= 30 : print('obesity') break

2nd Mar 2021, 1:31 PM
hanane el otmani
hanane el otmani - avatar
2 Answers
+ 4
your 2nd and 3rd condition is wrong it should be: elif res >= 18.5 and res < 25: print("Normal") elif res >= 25 and res < 30: print("Overweight") also there is no need for while and break here only if elif is sufficient. Note: weight should be int and height should be float
2nd Mar 2021, 1:49 PM
Sharique Khan
Sharique Khan - avatar
0
If you are trying to do the Project assignment at Python for Beginners course, your code needs to receive weight and height inputs (tip: revise 17.1 lesson, https://www.sololearn.com/learning/2426/ and https://www.sololearn.com/learning/4434/).
2nd Mar 2021, 1:38 PM
#0009e7 [get]
#0009e7 [get] - avatar