- 1

Bmi

#My code h = float(input()) w = float(input()) x = w / (h*h) if x < 18.5: print ("Underweight") elif (x >= 18.5 and x < 25): print ("Normal") elif (x >= 25 and x< 30.0): print ("Overweight") elif x > 30: print ("Obesity") Pass 1 test, but other not. What the wrong?

7th Jun 2021, 9:12 AM
Sasha Sch
4 Respostas
+ 5
Yes ! First the weight should be taken as input and then height .. This is because the input is given by the app itself it doesn't knew how to provide input in order . So, it is we who have to take care ! Moreover, One more technique which can be used here is swapping the Values of h and w Variables when h > w .. This is because we practically knew that weight is always greater in value when compared with height !
7th Jun 2021, 9:32 AM
ch Murali
+ 4
I have never done this before. It would be better if you provide the description. Maybe you have to take input weight first and then height.
7th Jun 2021, 9:26 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
ch Murali thanks, it’s rly work
7th Jun 2021, 9:43 AM
Sasha Sch
0
No problem ^_^ Sasha Sch keep learning !
7th Jun 2021, 2:53 PM
ch Murali