BMI (Body Mass Index) Calculator in Python

BMI (Body Mass Index) Calculator in Python

The objective of this Python post, you will see Python programs that cover the following:

  • Python Program BMI (Body Mass Index) Calculator

Python Program BMI (Body Mass Index) Calculator

  • Take input values from the user using python input() and convert it to float using float().
  • Next use the BMI formula, which is weight/(height**2).
  • Now print the result.
# take inputs from the user

height = float(input("Enter height in meters: "))
weight = float(input("Enter weight in kg: "))

# the formula for calculating bmi
bmi = weight/(height**2) 

# print result

print("Your BMI is: {0} ".format(bmi))

Output

Enter height in meters:  1.89 
Enter weight in kg:  65 
Your BMI is: 18.19657904313989  

Leave a Reply

Your email address will not be published. Required fields are marked *