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

8th Apr 2022, 10:36 PM
Baba Adam Mohammed
5 odpowiedzi
+ 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: …..
8th Apr 2022, 10:57 PM
Faisal Issaka
Faisal Issaka - avatar
+ 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.
9th Apr 2022, 12:36 AM
William Owens
William Owens - avatar
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.
8th Apr 2022, 10:41 PM
Danish Zubair
Danish Zubair - avatar
0
Yes, you should use float
8th Apr 2022, 10:58 PM
Danish Zubair
Danish Zubair - avatar
0
float(input())
9th Apr 2022, 5:15 AM
Zairy Putra