Python Program for BMI Calculation

Python program for bmi calculation; Through this tutorial, i am going to show you how to calculate bmi in python.

In this tutorial, i will use the formula to calculate BMI is $weight (kg)/{height (m)}^2$.

Python Program for BMI Calculation

  • Take input values from user and convert it to float.
  • Next use the BMI formula, which is weight/(height**2).
  • 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  

Recommended Python Tutorials

Leave a Comment