- 2
Where did i get wrong ???
height=float(input()) weight=float(input()) BMI=weight/(height*height) 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("obésity")
17 ответов
+ 2
Paul Bp The last condition should most probably be > and not >=
+ 3
In the last statement, the p of print should be a small letter and the output should be in double quotes.
https://code.sololearn.com/ck6b5sN3Sn31/?ref=app
+ 3
Paul Bepe
Try this one:
weight = int(input());
height = float(input());
bmi = weight/float(height*height);
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')
+ 2
Paul Bp your error in last statement "obésity" don't equal "Obesity". é != e
+ 1
But please Soumik let me know something is there a difference if i write
weight = int(input())
height = float(input())
bmi = weight / (height ** 2)
And if i put
height = float(input())
weight = int(input())
bmi = weight / (height ** 2)
If im asking the height first and the weight after ????
+ 1
Paul Bepe
Sololearn will automatically generate the 2 lines for taking input. Otherwise the code won't work because suppose it enters the height but you accept the weight first. This will be a big probem. So, don't touch the code that is generated for you.
+ 1
Thank Sathe Prerana Satish
+ 1
Paul Bepe most welcome 🙂
+ 1
You also can do something like num1 < compared_value < num2
+ 1
Elif 18.5 < bmi < 25:
You didnt do anything wrong im saying it might look nicer
0
Thank you. But instead or that m'y it doesnt work as it should. Try with 130 and 1.7 as input and see the output
0
Cool it work
0
But Илья Мирошник as its just à string To display is there really à mistake ???
0
Yes, your code checked by output information. If your output don't equal output of test, test is failed.
0
Илья Мирошник right !
0
Okay understood thank !Soumik
0
Thank you Simon Hadid