top of page

LearningMilestone by Anuradha Agarwal is a one-stop place for coding classes for kids and workshops for teachers and parents and self-paced courses, a blog for everyone to learn python programming with a personalized approach by an experienced instructor with a decade of experience in the software industry.

  • Writer's pictureAnuradha Agarwal

BMI Calculator Using Python



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










 

Recent Posts

See All
bottom of page