BMI Calculator using python
The formula to calculate BMI=weight(kg)/height (m)^2
Function to calculate BMI
This function takes two parameters:
‘weight'(the weight in kilograms)
‘height'(the height in meters)
BMI Stands for Body Mass Index is a measure of relative weight based on the mass and height of an individual. We use the body mass index in order to categorize people on the basis of their height and weight. these categories are underweight, healthy, overweight, and even obesity. moreover, it is also adopted by various countries in order to promote healthy eating.
we can consider Body Mass Index (BMI) as a substitute for direct measurements of body fat. besides, BMI is a low-cost and easy-to-perform method of screening for weight classes that may cause health-related problems.
1. Below 18.5 Underweight
2. 18.5-24.9 Normal
3. 25.0-29.9 Overweight
4.30.0 and above Obese
How to Calculate BMI in python code
weight=int(input())
height=float(input())
BMI=weight/height**2
Height=float(input("Enter your height in centimeters: ")) Weight=float(input("Enter your weight in kg: ")) Height = Height/100 BMI=Weight/Height*Height) print("your Body Mass Index is: ",BMI) if(BMI>0): if(BMI<=16): print("you are severely underweight") Elif(BMI<=18.5): print("you are underweight") Elif(BMI<=26): print("you are healthy") Elif(BMI<=30): print("you are overweight") else: print("you are severely overweight") else:("enter valid details")
output: Enter your height in centimeters: 190 Enter your weight in kg: 90 your Body Mass Index is: 30.367 you are overweight