I am creating a BMI calculator for a class assignment. My BMI keeps getting 0.0 no matter what I enter. Please Help!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | weight = float(input("Enter your weight in pounds: "))
height = float(input("Enter your height in inches: "))
height <= 0
weight <= 0
height_m = height/39.37
weight_kg = weight/2.2046
height_m = float()
weight_kg = float()
BMI1 = (weight/(height**2))
BMI2 = (weight_kg/(height_m**2))
print("Your BMI in in/lbs is: ", round(BMI1, 1))
print("\nYour BMI in m/kg is: ", round(BMI2,1))
|
The problem is that you are resetting the height and weight on lines 9 and 10. Also your formula for BMI1 should be (weight/height ** 2) * 703) for pounds/inches.
The problem is that you are resetting the height and weight on lines 9 and 10. Also your formula for BMI1 should be (weight/height ** 2) * 703) for pounds/inches.