0
Help
#tu cĂłdigo va aquĂ weight=0 hight=0 while True: weight = int(input()) hight = float(input()) masa = weight / hight ** 2 if masa <= 18.5: print('Underweight') elif (masa > 18.5) and (masa <= 24.9): print('Normal') elif (masa >= 25) and (masa <= 29.9): print('OverWeight') elif (masa >= 30): print('Obesity') https://code.sololearn.com/cVXHohF1ZM7A/?ref=app https://code.sololearn.com/cVXHohF1ZM7A/?ref=app
3 Answers
+ 1
Try this. It works
BMI=0
weight=float(input()) #weight in Kg
height=float(input()) #height in M
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")
+ 1
Thats true thank you.
0
Jose Luis
Why use a while loop?
This challenge can be resolved by simply using if, elif & else conditions
Testing your code shows that your while loop is looking for the next input, which causes an eof, End OfFile, error in Sololearn