7+ Python BMI Calculator Programs

This post contains a total of 7+ Python BMI Calculator Program Examples with Source Code. All these BMI ( Body mass index ) Calculator Programs are made using Python.

You can use the source code of these examples with credits to the original owner.

Related Posts

Python BMI Calculator Programs

1. BMI Calculator by Feba Jose

Made by Feba Jose. Source

Enter your weight (in kgs): 60
Enter your height (in m): 1.6
Normal
weight = float(input("Enter your weight (in kgs): \n"))
height = float(input("Enter your height (in m): \n"))
BMI=weight/(height**2)

if BMI<18.5:
    print("Underweight")
elif BMI>=18.5 and BMI<25.0:
    print("Normal")
elif BMI>=25.0 and BMI<30.0:
    print("Overweight")
else:
    print("Obesity")

2. BMI Calculator by Wong Kin Hou

Made by Wong Kin Hou. Source

Weight: 55.0KG
Height: 1.5M
BMI: 24
Category: Ideal
weight = float(input())
height = float(input())
print("{0}{1}{2}".format("Weight: ", weight, "KG"))

import math
if height>3:
    height = height / 100
    
print("{0}{1}{2}".format("Height: ", height, "M"))

BMI = int(weight / (height * height))

print("{0}{1}".format("BMI: ", round(BMI, 2)))

#weight category
if BMI > 24.99:
    print("category: Obese")
    Ideal_Weight = (24.99 * (height * height))
    rec = weight - Ideal_Weight 
    print("{0}{1}{2}".format("*Lose ", round(rec, 3), "KG to ideal BMI"))

elif BMI < 18.5:
    print("Category: Underweight")
    Ideal_Weight  =(18.5 * (height * height))
    rec = Ideal_Weight - weight
    print("{0}{1}{2}".format("*Gain ", round(rec, 3), "KG to ideal BMI"))
    
else:
    print("Category: Ideal")

3. BMI Calculator by IBRAHIM SULE UDI

Made by IBRAHIM SULE UDI. Source

bmi: 
22.5
name = "Ibrahim"
height_m = 2
weight_kg = 90

bmi = weight_kg / (height_m ** 2)
print ("bmi: ")
print (bmi)

4. Fixed bmi calculator

Made by ABHINAV BALODHI. Source

enter your weight then Height: 
55
160
Normal
#first entet Weight then Height(centimeter)#
Weight= float(input("enter your weight then Height: "))
Height= float(input())
Bmi = Weight / (Height/100)**2
if Bmi < 16:
   print("severe thinness")
elif Bmi >16 and Bmi < 17:
    print("Moderate thinness")
elif Bmi < 18.5 and Bmi > 18.5 :
   print("Mild thinness")
elif Bmi > 18.5 and Bmi < 25:
    print("Normal")
elif Bmi > 25 and Bmi < 30:
    print("Overweight")
elif Bmi > 30 and Bmi < 35:
    print("Obesity class 1")
elif Bmi> 35 and Bmi < 40:
    print("Obesity class 2")
elif Bmi > 40:
    print("Obesity class 3")

5. Simple BMI calculator

Made by Vin C. Source

Please input your weight in Kgs: 
55.0
Now enter your height in metres: 
1.5
Your BMI is: 
 24.44 Kg/m^2


Your weight is normal
print ("Welcome to Vin C\'s python BMI calculator!")
print ("This BMI calculator follows the standard formula of Weight x (Height ^2)")
print ("\n")

'''
input as:
Weight
Height
'''

#Weight and height are printed only for demonstrative purposes
#WIP for invalid inputs
Weight = float(input("Please input your weight in Kgs: \n"))
if Weight <=0:
    print ("You have entered an invalid Weight")
else:
    print (Weight)
Height = float(input("Now enter your height in metres: \n"))
if Height <=0:
    print ("You have entered an invalid Height")
else:
    print (Height)

BMI = Weight / (Height**2)

#Rounding of float is done by %.2f to print only 2 characters
#This is also done for a more accurate auto-categorisation
x = float("%.2f" % BMI)
print ( "Your BMI is: \n", x , "Kg/m^2")
print ("\n")

#Auto display BMI category
if x < 18.5:
    print ("You are underweight")
if 18.5 <= x <= 24.9:
    print ("Your weight is normal")
if 25 <= x <= 29.9:
    print ("You are overweight")
if x > 30:
    print ("You are obese")

#BMI categories
a = ["Underweight = <18.5", "Normal weight = 18.5 - 24.9", "Overweight = 25 - 29.9", "Obesity = BMI of 30 or greater",]
print ("\n")
print ("BMI categories:")
print (a[0])
print (a[1])
print (a[2])
print (a[3])

6. BMI Calculator by Oualid Elbouni

Made by Oualid Elbouni. Source

26.729927495071667
jack is over weight.

19.37919743392696
mark is not over weight.

20.449137418203453
matilda is not over weight.
#first person
name1 = "jack"
weight1_kg = 80
height1_m = 1.73
#second person
name2 = "mark"
weight2_kg = 58
height2_m = 1.73
#third person
name3 = "matilda"
weight3_kg = 55
height3_m = 1.64

#setting the bmi function
def bmi_calculator(name, weight, height):
    bmi = weight/height**2
    if bmi<25:
        return name + " is not over weight."
    else:
        return name + " is over weight."
result1 = bmi_calculator(name1, weight1_kg, height1_m)
result2 = bmi_calculator(name2, weight2_kg, height2_m)
result3 = bmi_calculator(name3, weight3_kg, height3_m)
bmi1 = weight1_kg/height1_m**2
bmi2 = weight2_kg/height2_m**2
bmi3 = weight3_kg/height3_m**2
print(bmi1)
print(result1)
print(bmi2)
print(result2)
print(bmi3)
print(result3)

7. BMI Calculator by Kristian Ernst

Made by Kristian Ernst. Source

 your weight in kg: 60

 your height in m: 1.6

 your BMI is...

23.437499999999996

 which means that:

 you have a normal BMI
print("this is a BMI calculator")

print("here is the categories of the different BMI types:" + "\n below normal: < 18.5" + "\n normal: 18.5-24.9" + "\n a bit above normal: 25-29.9" + "\n above normal: 30-39.9" + "\n heavily above normal: 40+")

a=input("\n your weight in kg: ")
print(a)
b=input("\n your height in m: ")
print(b)

print("\n your BMI is...\n")

print(float(a)/float(b)**2)

print("\n which means that:")
BMI=(float(a)/float(b)**2)

if BMI<18.5:
    print("\n you have a BMI that is below normal")
elif BMI>=18.5 and BMI<25:
    print("\n you have a normal BMI")
elif BMI>=25 and BMI<30:
    print("\n you have a BMI that is a bit above the normal")
elif BMI>=30 and BMI<40: 
    print("\n you have a BMI that is above normal")
elif BMI>40:
    print("\n you have a BMI that is heavily above normal")

8. BMI Calculator by Shubhank Gupta

Made by Shubhank Gupta. Source

 PERSONALISED BMI REPORT FOR : Shubhank
the BMI (body mass index) of Shubhank is 21.877551020408163
Wow ! , you are completely healthy , going good :) 
                            
 PERSONALISED BMI REPORT FOR : Random1
the BMI (body mass index) of Random1 is 20.0
 All you need to do is to increase your diet , luckily you dont have to sweat in the gyms :)
                            
 PERSONALISED BMI REPORT FOR : Random2
the BMI (body mass index) of Random2 is 25.0
 You gotta workout and carefully plan your diet 
print("Hi there ! , this is a BMI Calculator ")
print('                            ')
print("To start off with , I would like to know the names of the three people whose BMI you want to know")
print('                            ')
name1 = 'Shubhank'
name2 = 'Random1'
name3 = 'Random2'
print('Thanks , I\'ll remember it ')
print('Now please tell their heights in respective order ')
print('                            ')
h1 = 1.75
h2 = 2
h3 = 2
print('Thanks , now tell me their weights also and wait till I prepare their personalised reports :)')
w1 = 67
w2 = 80
w3 = 100
# Applying the function
def bmi_func (name , height , weight):
    bmi = weight/height** 2
    print(' PERSONALISED BMI REPORT FOR :' , name )
    print ('the BMI (body mass index) of', name , 'is', float(bmi))
    if 20 < bmi < 25 :
        print( 'Wow ! , you are completely healthy , going good :) ') 
    else :
        if bmi < 25 :
            print ( ' All you need to do is to increase your diet , luckily you dont have to sweat in the gyms :)')
        else : 
            print ( ' You gotta workout and carefully plan your diet ')
print('                           ')

       
        
bmi_func (name1 , h1, w1)
print('                            ')
bmi_func (name2 , h2 , w2)
print('                            ')
bmi_func (name3 , h3 ,w3)