Change language

Program for calculating body mass index (BMI)

Index body mass (BMI) or Quetelet index — it is a value derived from the mass (weight) and height of a person, man or woman. BMI is defined as body weight divided by the square of height and is expressed universally in units of kg / m2 as a result of weight in kilograms and height in meters. Formula:

 BMI = (mass or weight) / (height * height) where, mass or weight is in Kg, height is in meters 

Examples:

 Input: height (in meter): 1.79832 weight (in Kg): 70 Output: The BMI is 21.64532402096181, so Healthy. Explanation: 70 / (1.79832 * 1.79832) Input: height (in meter): 1.58496 weight (in Kg): 85 Output: The BMI is 33.836256857260594 so Suffering from Obesity Explanation: 70 / (1.58496 * 1.58496) 

# Python program for illustration
# how to calculate BMI

def BMI (height, weight):

bmi = weight / (height * * 2 )

return bmi

 
  # Driver code

height = 1.79832

weight = 70

  
# call BMI function

bmi = BMI (height, weight)

print ( "The BMI is" , format (bmi), "so " , end = ’ ’)

 
# Conditions to check the BMI category

if (bmi & lt;  18.5 ):

  print ( "underweight" )

 

elif (bmi" = 18.5 and bmi " 24.9 ):

print ( "Healthy" )

 

elif (bmi" = 24.9 and bmi " 30 ):

print ( " overweight " )

 

elif (bmi & gt ; = 30 ):

print ( " Suffering from Obesity " )

Output:

 The BMI is 21.64532402096181 so Healthy 

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

News


Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method