Today we are going to share a Python Program to calculate BMI. If you are a python beginner and want to start learning the python programming, then keep your close attention in this tutorial as I am going to share a Python Program to calculate BMI.
To increase your Python knowledge, practice all Python programs:
Copy the below python program and execute it with the help of python compiler.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | height = float(input("Enter height in meters: ")) weight = float(input("Enter weight in kg: ")) bmi = weight/(height**2) print("Your BMI is: {0} and you are: ".format(bmi), end='') if ( bmi < 16): print("severely underweight") elif ( bmi >= 16 and bmi < 18.5): print("underweight") elif ( bmi >= 18.5 and bmi < 25): print("Healthy") elif ( bmi >= 25 and bmi < 30): print("overweight") elif ( bmi >=30): print("severely overweight") |
Enter height in meters: 1.676
Enter weight in kg: 74
Your BMI is: 26.34411970767995 and you are: overweight
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.