BMI calculator in python

BMI calculator in python full tutorial | Python Bootcamp


In this post, you will learn how to make the BMI calculator in python and also I will teach every piece of code and what it does and below is the video format of the post, check it out ????????


What is BMI calculator

BMI stands for “Body mass index“, and these BMI calculators will be helpful for keeping health properly and to find you are underweight, overweight, healthy or fat.

Below is the chart for the BMI calculator ????????

BMI calculator

BMI Calculator python code

Below is the BMI calculator python code,

height = input(“Please enter your height in meter: “)
weight = input(“Please enter your weight in kg: “)

The height and weight will be get from the user using the input function and you know very well the BMI = weight / height ** 2

You need to use this formula ☝

Now if you just print the result you won’t get the result instead you get an error. Like this ????????

BMI calculator

This is because the str and int are together as I said in the previous post the str and int will not be together.

So, what I am doing is specifying the data type, like this ????????

Once, I added the data types and again I am doing a type conversion and changing the value int. So, I get the values in whole numbers.

Now, if I run the code the result will be looking something like this ????????????

BMI calculator

So, Finally, we have successfully created the BMI calculator in python and if you have any doubts or if you got any errors comment down below, I will answer in 12 hrs.

If you wanted to print the result in a good and meaningful format then enter this code that is the, .format

BMI calculator

So, this is how to make the result in a more meaningful format. See you in next post ????

Also Read: Type function in python

Also Read: Arithmetic operators in python

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions or brave browser to block ads. Please support us by disabling these ads blocker.Our website is made possible by displaying Ads hope you whitelist our site. We use very minimal Ads in our site


Scroll to Top