DEV Community

Discussion on: How to build a BMI Calculator in Python

Collapse
 
adam_filip_9b9274b36e228f profile image
Adam Filip

when you input something python automaticly see it as a string. Make sure you put float in front of height and weight formula.
weight = float(input("Enter your weight in cm: "))
height = float(input("Enter your height in cm: "))

Collapse
 
adam_filip_9b9274b36e228f profile image
Adam Filip

Also I think that BMI = (height * weight) is wrong. It should be
BMI = weight_kg / (height_cm/100)**2