+ 1
Python, 28 test, BMI calculator
weight=int(input()) height=float(input()) x=weight y=height i=x/(y**2) if i<18.5: print("Underweight") elif i>=18.5 and i<=24.9: print("Normal") elif i>=25 and i<=29.9: print("Overweight") elif i>=30: print("Obesity") I have 4/5 test correct Can anybody say what’s wrong and why? I know the solution, but do not understand it :c What difference between “i<=24.9” and “i<25”; “i<=29.9” and “i<30”
5 Antworten
+ 6
Yup! You're correct
They did a mistake in Russian version.
You can check the English version.
Ranges are given correctly.
https://ibb.co/gzMyxJ7
+ 2
Try this if you need explanations you can always ask...
#your code goes here
weight = float(input())
height = float(input())
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")
elif (bmi >= 30):
print("Obesity")
+ 1
Many thanks! I knew there might be a mistake but didn’t expect to find it in the task :)
0
Because of the task:
Underweight = less than 18.5
Normal = 18.5 - 24.9
Overweight = 25 - 29.9
Obesity = 30 and more
0
Can it be a problem only in russian version or not, I don’t know.