BMI Calculator using python
Hello dudes! Long time no see.. Hope you are all doing great😃
After absconding for more than a month we came today to meet you all with a simple python program to calculate your own BMI (Body Mass Index)
FYI what is mean by Body Mass Index?
Body mass index (BMI) is a simple index of weight-for-height that is commonly used to classify overweight and obesity in adults. It is defined as a person's weight in kilograms divided by the square of his height in meters (kg/m2).
[ If (You think == He might have stolen this definition of BMI from Wikipedia):
You are wrong ]
Hehe😁 actually i have stolen this definition from World Heath Organization
So the program is :
Explanation :
- Height (in cm) and Weight (in kg ) asked from user as inputs in runtime. Here both the variables are declared as float datatype ,which allows decimal values in input.
- Unit of height is converted from cm to m
- BMI formula with respect to height and weight is defined
-As per user input the calculated BMI value is compared with different conditions to give the state of the body as output . (This operation is done by if , elif and else condition statements).
Output :
In this case the user's height is "170cm" and weight is "60kg" . The calculated BMI value is "20.76kg/m2" .
Since this value lies between 18.5kg/m2 and 25kg/m2 , the output is "You are Healthy"
Thats all for today dudes . Hope you all found this useful.
See you all with other set of codes until then bubye!!
Enjoy Coding😉
Comments
Post a Comment