Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
Python program to calculate BMI(Body Mass Index) of your Body
Body Mass Index (BMI) is a measure used to determine whether a person has a healthy body weight for their height. The BMI formula is: BMI = weight (kg) / height² (m²).
Algorithm
Step 1: Input height in meters and weight in kilograms Step 2: Apply the BMI formula: weight / (height × height) Step 3: Display the calculated BMI value Step 4: Interpret the BMI category
Basic BMI Calculator
Here's a simple program to calculate BMI −
height = float(input("Enter your height (m): "))
weight = float(input("Enter your weight (kg): "))
bmi = round(weight / (height * height), 2)
print("Your BMI is:", bmi)
Enter your height (m): 1.75 Enter your weight (kg): 70 Your BMI is: 22.86
BMI with Health Categories
This enhanced version also shows the BMI category −
height = float(input("Enter your height (m): "))
weight = float(input("Enter your weight (kg): "))
bmi = round(weight / (height * height), 2)
print(f"Your BMI is: {bmi}")
if bmi < 18.5:
print("Category: Underweight")
elif bmi < 25:
print("Category: Normal weight")
elif bmi < 30:
print("Category: Overweight")
else:
print("Category: Obese")
Enter your height (m): 1.75 Enter your weight (kg): 70 Your BMI is: 22.86 Category: Normal weight
BMI Categories
| BMI Range | Category |
|---|---|
| Below 18.5 | Underweight |
| 18.5 - 24.9 | Normal weight |
| 25.0 - 29.9 | Overweight |
| 30.0 and above | Obese |
Conclusion
BMI is calculated using the formula weight / height². While BMI is a useful screening tool, consult healthcare professionals for comprehensive health assessment as BMI doesn't account for muscle mass or body composition.
Advertisements
