top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

BMI calculator using python

Body mass index (BMI) is a measure of body fat based on height and weight that applies to adult men and women. It is a measure for the healthiness of the body in terms of physical body calculation. Furthermore, it also clarify about the obesity.


First, we require the height and weight of the person. Here we have input the height and weight in python and convert it into number.


#take height in feet and inches format as input from user
print('Enter your height in feet and inches')
print('Feet=')
feet = float(input())
print('Inches=')
inches = float(input())
height = feet*12+inches
# Take weight as input in pound
print('Enter your weight in pounds')
print('Weight = ')
weight = float(input())

Then we calculate the bmi using formula.

#Calculate BMI using formula
bmi = (weight/(height*height))*703
print('Your BMI is ',round(bmi,2))

Finally we also show the remarks according to the output of bmi.

#Check for under, normal, over weight or obesity
if bmi<=18.5:
    print('Underweight')
elif bmi>18.5 and bmi<=24.9:
    print('Normal weight')
elif bmi>=25 and bmi>=29.9:
    print('Over weight')
else:
    print('Obesity')

Github: https://github.com/ranjan435/data-insight-2021/blob/main/bmi.ipynb

1 comment

Recent Posts

See All

1 Comment


Data Insight
Data Insight
Sep 19, 2021

Do not insert codes as images. Use the code snippet functionality.

Like
bottom of page