0
weight=int(input()) height=int(input()) BMI=weight/height if BMI<18.5: print (" Under weight ") elif BMI>=18.5 and BMI<25:
Can someone please tell me what is wrong with my code
5 Réponses
+ 1
Okay so in the first place i think you should use float instead of int
And the elif block could be reduced to
elif 18.5 <= BMI < 25:
…..
+ 1
1. BMI should equal weight in kilograms divided by (height in meters) squared. And as everyone has stated I would suggest a FP number to take care for the decimal division.
2. If-else conditionals stop at the first true statement
if bmi <= 18.5: print("underweight")
elif bmi <= 25: print("normal weight")
etc..
else print("your default if none are true")
Hope that helps.. Look forward to seeing your codes.
0
In my opinion, probably you need to add a number on weight and height in the first two lines, in my opinion. Try that and let me know.
0
Yes, you should use float
0
float(input())