BMI Calculator Using Python

Updated: Dec 8, 2021



The Body Mass Index (BMI) is used to determine whether an adult is overweight or underweight for his or her height. The formula used to calculate the BMI of an adult is

BMI = weight(in kg)/ (height*height(in meter))

In this program, BMI calculator is to be built using python. To understand concepts, follow this tutorial:



 

Concepts Covered


if-else, input, f-string, round, data type conversion

 

Problem Description


Write a program to calculate the BMI of a person on the basis of input taken from a user for the weight (in kg) and height(in m). Once BMI is calculated, the user needs to be indicated based on BMI if the user is underweight, normal, overweight or obese.

BMI Range

​BMI Status

Less than 18.0

Underweight

Between 18.0 and 24.9

Normal weight

Between 25.0 and 29.9

Overweight

30 or More

Obese

How It Should Work


Approach


  1. Create a variable called weight and store it in weight inputted by the user on prompt. Make sure you convert it into float data type

  2. Create a variable called height and store it in height inputted by the user on prompt. Make sure you convert it into float data type

  3. Calculate BMI using the formula - weight/(height*height) and store it in a variable called BMI

  4. Using if elif and else, compare BMI with different values

  5. print using f-string user's BMI along with the description


 

Solution









 

53 views0 comments

Recent Posts

See All