0

Why my code ain't working?

w = int( input ()) r = (input()) ra = (r * r) imt = w / ra if (imt) < 18.5: print ("underweight") if (imt) > 18.5 and (imt) < 24.9: print ("normal") if (imt) > 24 and (imt) < 29.9: print ("overweight") if (imt) >= 30: print ("obesity")

28th Apr 2021, 5:26 PM
Лубягин Кирилл
Лубягин Кирилл - avatar
5 Respostas
+ 6
You need to use float() for height The first letter of the output variables should be uppercase 2nd & 3rd conditions are wrong in Russian language. w = int( input ()) r = float(input()) ra = (r * r) imt = w / ra if (imt) < 18.5: print ("Underweight") elif (imt) >= 18.5 and (imt) < 25: print ("Normal") elif (imt) >= 25 and (imt) < 30: print ("Overweight") elif (imt) >= 30: print ("Obesity")
28th Apr 2021, 5:45 PM
Simba
Simba - avatar
+ 1
May be your code wants promotion?
28th Apr 2021, 6:08 PM
Shadoff
Shadoff - avatar
+ 1
Это шутка такая! -Почему мой код не хочет работать? -Может твой код хочет повышения.. (По должности или заработной платы)
28th Apr 2021, 6:15 PM
Shadoff
Shadoff - avatar
0
In the 2nd line you haven't converted str to int. Also, you have put 2nd, 3rd and 4th 'if' condition under the first one. I think you should better use elif instead of if in 7th and 9th line, and else in 11th line: w = int( input ()) r = int(input()) ra = r * r imt = w / ra if imt < 18.5: print ("underweight") elif imt >= 18.5 and imt < 24.9: print ("normal") elif imt >= 24 and imt < 29.9: print ("overweight") else: print ("obesity")
28th Apr 2021, 5:42 PM
Md. Faheem Hossain
Md. Faheem Hossain - avatar
0
How?
28th Apr 2021, 6:09 PM
Лубягин Кирилл
Лубягин Кирилл - avatar