Calculate BIM | Sololearn: Learn to code for FREE!

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

3/2/2021 1:31:45 PM

hanane el otmani

2 Answers

New Answer

+3

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

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/).