What's wrong with my code?......it shows correct output bt still they say it's wrong | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

What's wrong with my code?......it shows correct output bt still they say it's wrong

x= int(input()) y= float(input()) bmi= x/(y*y) 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')

23rd Apr 2021, 7:38 AM
Raven Black
Raven Black - avatar
9 Respuestas
+ 6
First letter of the output variables should be uppercase Underweight, Normal.....
23rd Apr 2021, 9:20 AM
Simba
Simba - avatar
+ 5
If bmi of 18.5 is considered "Normal", your code would display "Underweight" because of the comparing operators you have used in your first if statement. bmi <= 18.5 elif bmi>=18.5 and bmi<=25 you can see both have "=" in them.
23rd Apr 2021, 7:42 AM
RKK
RKK - avatar
+ 2
What do you mean "not working"? Can you give an example where its wrong?
23rd Apr 2021, 7:56 AM
RKK
RKK - avatar
+ 2
Maybe, your internet connection is poor!
23rd Apr 2021, 8:09 AM
RKK
RKK - avatar
+ 2
Thanks dude now its working
23rd Apr 2021, 10:50 AM
Raven Black
Raven Black - avatar
+ 1
I did other examples too everything is fine....bt this one is not working..... it's ok thanks for your time dude
23rd Apr 2021, 8:13 AM
Raven Black
Raven Black - avatar
0
I even corrected that mistake......and even tried others code still it shows correct output bt it's not working
23rd Apr 2021, 7:54 AM
Raven Black
Raven Black - avatar
0
My output shows the correct output bt it still shows try again
23rd Apr 2021, 7:59 AM
Raven Black
Raven Black - avatar
0
Right! Bt it's not working for me...
23rd Apr 2021, 8:09 AM
Raven Black
Raven Black - avatar