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

Writer: Prativa BhattaPrativa Bhatta

Body Mass Index(BMI) is a measure of body fat based on height and weight that applies to adult men and women. On this basis, a persons BMI value can be categorized as follows:

Underweight = <18.5


Normal weight = 18.5–24.9


Overweight = 25–29.9


Obesity = BMI of 30 or greater


Formula to calculate BMI is:

BMI = Body weight/ Body height**2

As the weight is measured in kilograms and height is measured in metres, the unit of BMI is written as kilograms per metre square.


First, let's prompt the user to enter their data



weight = float(input("Weight in kilograms: "))
height = float(input("Height in metres: "))


Now, we will calculate the BMI using our formula. We used abs() method if the user accidentally input negative numbers. Also we are using except in case the user inputs invalid values.


bmi = 0
try:
    bmi = abs(weight / height ** 2)
except:
    print("Please enter a valid weight and height before proceeding!")

Finally, we can display a BMI category of the user according to their input using a simple  if...elif...else  structure.



if bmi <= 18.5:
    print("You are underweight. Are you taking nutrient rich food and enough meal?")
elif bmi < 25:
    print("Congratulations! You're normal weight. Keep up your healthy diet :)")
elif bmi < 30:
    print("You are overweight. Try to maintain a balanced diet with some physical exercises.")
else:
    print("You are obese. Obesity has many detrimental health implications.")

With this you can easily calculate your BMI. But beside this make sure to take proper care of your health.




 
 

Comentários


COURSES, PROGRAMS & CERTIFICATIONS

 

Advanced Business Analytics Specialization

Applied Data Science with Python (University of Michigan)

Data Analyst Professional Certificate (IBM)

Data Science Professional Certificate (IBM)

Data Science Specialization (John Hopkins University)

Data Science with Python Certification Training 

Data Scientist Career Path

Data Scientist Nano Degree Program

Data Scientist Program

Deep Learning Specialization

Machine Learning Course (Andrew Ng @ Stanford)

Machine Learning, Data Science and Deep Learning

Machine Learning Specialization (University of Washington)

Master Python for Data Science

Mathematics for Machine Learning (Imperial College London)

Programming with Python

Python for Everybody Specialization (University of Michigan)

Python Machine Learning Certification Training

Reinforcement Learning Specialization (University of Alberta)

Join our mailing list

Data Insight participates in affiliate programs and may sometimes get a commission through purchases made through our links without any additional cost to our visitors.

bottom of page