- 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")

4th Apr 2021, 11:10 AM
Paul Bepe
Paul Bepe - avatar
17 Réponses
+ 2
Paul Bp The last condition should most probably be > and not >=
4th Apr 2021, 11:22 AM
Soumik
Soumik - avatar
+ 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
4th Apr 2021, 11:15 AM
Soumik
Soumik - avatar
+ 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')
4th Apr 2021, 8:37 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 2
Paul Bp your error in last statement "obésity" don't equal "Obesity". é != e
4th Apr 2021, 12:10 PM
Илья Мирошник
Илья Мирошник - avatar
+ 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 ????
4th Apr 2021, 11:39 AM
Paul Bepe
Paul Bepe - avatar
+ 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.
4th Apr 2021, 1:59 PM
Soumik
Soumik - avatar
4th Apr 2021, 8:40 PM
Paul Bepe
Paul Bepe - avatar
+ 1
Paul Bepe most welcome 🙂
4th Apr 2021, 8:46 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 1
You also can do something like num1 < compared_value < num2
6th Apr 2021, 6:32 AM
Lucas
Lucas - avatar
+ 1
Elif 18.5 < bmi < 25: You didnt do anything wrong im saying it might look nicer
7th Apr 2021, 4:50 AM
Lucas
Lucas - avatar
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
4th Apr 2021, 11:20 AM
Paul Bepe
Paul Bepe - avatar
0
Cool it work
4th Apr 2021, 11:27 AM
Paul Bepe
Paul Bepe - avatar
0
But Илья Мирошник as its just à string To display is there really à mistake ???
4th Apr 2021, 12:20 PM
Paul Bepe
Paul Bepe - avatar
0
Yes, your code checked by output information. If your output don't equal output of test, test is failed.
4th Apr 2021, 12:27 PM
Илья Мирошник
Илья Мирошник - avatar
4th Apr 2021, 12:34 PM
Paul Bepe
Paul Bepe - avatar
0
Okay understood thank !Soumik
4th Apr 2021, 4:19 PM
Paul Bepe
Paul Bepe - avatar
0
Thank you Simon Hadid
7th Apr 2021, 3:22 PM
Paul Bepe
Paul Bepe - avatar