BMI(Body Mass Index) Calculator Using Python

Jayeeta Mondal
2 min readNov 15, 2021

--

Photo by i yunmai on Unsplash

Tracking your BMI is a useful way of checking if you’re maintaining a healthy weight or not. BMI is calculated using a person’s weight and height, using the formula: weight(kg) / (height(m))². 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. In this article you will learn how to calculate BMI using python.

What Is BMI & Why Do We Need It

BMI can determine how your body weight is related to your height. We can classify people as underweight, overweight or obese by seeing the BMI value. Later we can consult with the healthcare provider to improve our overall wellness & reduce the risk of disease related to it.

BMI Categories:
Underweight = <18.5
Normal weight = 18.5–24.9
Overweight = 25–29.9
Obesity = BMI of 30 or greater

BMI Calculator Using Python

In the above snippet of code, we first take input from the user as height & weight. Then we have used the value of the variable BMI in the if-elif-else statement to check if the BMI of the person lies within one of the categories. If BMI is less than or equal to 18.5 then the program returns the condition for underweight. If BMI is less than or equal to 24.9 then the program returns the condition for Healthy. If BMI is less than or equal to 29.9 then the program returns the condition for overweight. If none of the above conditions are True then the program returns the condition for obese.

Output

This python project is mainly for beginners. I hope you liked this article. If you have any question, feel free to ask in the comments section below.

--

--

Jayeeta Mondal
Jayeeta Mondal

Written by Jayeeta Mondal

Data Scientist || Freelancer || Open Source Contributor

No responses yet