0

BMi calculator

Hello Guys, please my code is false? height=float(input()) weight=float(input()) result=(weight/(height**2)) if result<18.5 : print("Underweight") elif (result>=18.5 and result<25): print("Normal") elif (result>=25 and result< 30): print("Overweight") elif (result>=30): print("Obesity") or l must do it: height=float(input()) weight=float(input()) result=(weight/(height**2)) if result<18.5 : print("Underweight") elif ( result<25): print("Normal") elif ( result< 30): print("Overweight") elif (result>=30): print("Obesity")

18th Jul 2022, 11:00 AM
Ryan
6 Answers
0
Yes you need to first take input for weight, than height,if you look for input for test 1 you will see this: 52 1.85 Weight is in kg, height is in meter. And weight is intiger, where height is float.
18th Jul 2022, 11:19 AM
PanicS
PanicS - avatar
+ 2
Ryan the task recommends integer, but float is maybe a better option after all, because the calculation is in float so Python will have to convert it from int to float anyway. JSYK, to make it integer you would use the int() function. Either program should work if you match the order of inputs that the task specifies - weight first, then height.
18th Jul 2022, 1:17 PM
Brian
Brian - avatar
+ 2
Thank you very much Brian. The program work
18th Jul 2022, 2:10 PM
Ryan
0
Hello Brian you said that, l must start declaration by weight before height?
18th Jul 2022, 11:05 AM
Ryan
0
why weight is intiger? weight ca be negative?
18th Jul 2022, 12:29 PM
Ryan
0
Please, when l put weight in intiger NameError: name 'integer' is not defined
18th Jul 2022, 12:33 PM
Ryan