BMI (Body Mass Index) calculator in Python

In this Python article, we will figure out how to make a BMI (represents – Body Mass Index) adding machine?

Given the weight and tallness of an individual and we need to discover the BMI (Body Mass Index) utilizing Python.

Example:

    Input:
    Height = 1.75
    Weigth = 64

    Output:
    BMI is: 20.89 and you are: Healthy

The means that we will pursue are:

We will initially get input esteems from client utilizing information() and convert it to skim utilizing glide().

We will utilize the BMI equation, which is weight/(height**2).

At that point print the outcome utilizing restrictive articulations.

Here we have utilized elif on the grounds that once we fulfil a condition we would prefer not to check the remainder of the announcements.

Program to ascertain BMI in Python

# getting input from the user and assigning it to user

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

# the formula for calculating bmi

bmi = weight/(height**2) 
# ** is the power of operator i.e height*height in this case

print("Your BMI is: {0} and you are: ".format(bmi), end='')

#conditions
if ( bmi < 16):
   print("severely underweight")

elif ( bmi >= 16 and bmi < 18.5):
   print("underweight")

elif ( bmi >= 18.5 and bmi < 25):
   print("Healthy")

elif ( bmi >= 25 and bmi < 30):
   print("overweight")

elif ( bmi >=30):
   print("severely overweight")

Output

BMI (Body Mass Index) calculator in Python

On the off chance that you loved the article or have any uncertainty if it’s not too much trouble writing in the remark box.

Leave a Comment

error: Alert: Content is protected!!