Python Projects

BMI Calculator with Python

PREREQUISITES

To Practice this Program, you should have a basic knowledge of the following Topics:

PYTHON-FUNCTIONSS

INPUT & PRINT FUNCTION

We will use Input & Print Function to collect & print data from the website user into variables.

dt

INTEGER, FLOAT & STRING

We will accept the user input in float or integer so that it can be calculated & use str to print numeric with string.

WHAT TO DO ?

Given,

Formula for BMI : weight/(height**2)

Ask the user for necessary information and return BMI Score.

HOW TO DO ?

Following are the steps to do :

01.

ASK HEIGHT & WEIGHT

At First, We have to ask user’s height and weight.

</p>
<div class="wp-block-codemirror-blocks-code-block code-block">
<pre>height = float(input("What is your height in meters ? "))
weight = float(input("What is your weight ? "))</pre>
</div>
02.

CALCULATE & PRINT BMI

Finally, We will calculate the BMI to return it to user.

<div class="wp-block-codemirror-blocks-code-block code-block">
<pre>bmi = weight/(height**2)
print("Your Body Mass Index(BMI) is " + str(bmi))</pre>
</div>
Things We Covered
  • Accepting User Data (Input Function)
  • Calculating Formula (Integer/Float Calculation)
  • Print/Output the Data (Print Function)

Posted by Akshay Gupta

Leave a Reply

Your email address will not be published. Required fields are marked *