- Home
- DS & Algo. ▾
- Data Structure
- Algorithms
- Coding Problems
- Languages ▾
- C
- C++
- C++ STL
- Java
- Python
- Scala
- Ruby
- C#.Net
- Golang
- Android
- Kotlin
- SQL
- Web. ▾
- JavaScript
- CSS
- jQuery
- PHP
- Node.Js
- AdonisJs
- VueJS
- Ajax
- HTML
- Django
- Programs ▾
- C
- C++
- Data Structure
- Java
- C#.Net
- VB.Net
- Python
- PHP
- Golang
- Scala
- Swift
- Rust
- Ruby
- Kotlin
- C Interview Programs
- Aptitude ▾
- C Aptitude
- C++ Aptitude
- Java Aptitude
- C# Aptitude
- PHP Aptitude
- Linux Aptitude
- DBMS Aptitude
- Networking Aptitude
- AI Aptitude
- More...
- Interview ▾
- Golang
- MIS Executive
- DBMS
- C
- Embedded C
- Java
- SEO
- HR
- Find Output ▾
- C
- C++
- C#.Net
- Java
- Go
- PHP
- More...
- MCQs ▾
- Web Technologie MCQs
- CS Subjects MCQs
- Databases MCQs
- Programming MCQs
- Testing Software MCQs
- Digital Mktg Subjects MCQs
- Cloud Computing S/W MCQs
- Engineering Subjects MCQs
- Commerce MCQs
- More MCQs...
- CS Subjects ▾
- Machine Learning/AI
- Operating System
- Computer Network
- Software Engineering
- Discrete Mathematics
- Digital Electronics
- Data Mining
- MIS
- DBMS
- Embedded Systems
- Cryptography
- CS Fundamental
- More Tutorials...
- More ▾
- Tech Articles
- Puzzles
- Full Forms
- Code Examples
- Blogs
- Guest Post
- Programmer's Calculator
- XML Sitemap Generator
- About
- Contact
Advertisement
Home »Python »Python Programs
Python BMI Calculator Program: In this tutorial, we will learn how to design a BMI calculator using Python program?By Anoop Nair Last updated : April 13, 2023
What is Body Mass Index (BMI)?
The Body Mass Index (BMI) is a value used to define the ratio of a person's weight and height. Mathematically, BMI can be calculated as the body weight (in kg) divided by square of the person's height (in meters).
How to Calculate Body Mass Index (BMI)?
To calculate BMI, divide the weight (in kilogram) by height (in meters) squared. The formular is to calculate BMI is weight/(height2).
Logic to Calculate BMI (Body Mass Index) in Python
The following are the steps (logic) you should follow to implement a BMI calculator in Python:
- We will first get input values from user using input() and convert it to float using float().
- We will use the BMI formula, which is weight/(height**2).
- Then print the result using conditional statements.
- Here we have used elif because once we satisfy a condition we don't want to check the rest of the statements.
Example
Given weight and height of a person and we have to find the BMI (Body Mass Index) using Python.
Sample Input/Output
Input:Height = 1.75Weigth = 64Output:BMI is: 20.89 and you are: Healthy
Python Program to Implement BMI (Body Mass Index) Calculator
# getting input from the user and assigning it to userheight = float(input("Enter height in meters: "))weight = float(input("Enter weight in kg: "))# the formula for calculating bmibmi = weight/(height**2) # ** is the power of operator i.e height*height in this caseprint("Your BMI is: {0} and you are: ".format(bmi), end='')#conditionsif ( 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")
Output
If you liked the article or have any doubt, please write in the comment box.
Python Basic Programs »
Python | Declare any variable without assigning any value
Find Odd and Even Numbers from the List of Integers in Python
Related Programs
- Python | Find the factorial of a number using recursion
- Python | Declare any variable without assigning any value.
- Python | Program to print Odd and Even numbers from the list of integers.
- Python | Program to print Palindrome numbers from the given list.
- Python | Compute the net amount of a bank account based on the transactions.
- Python | Count total number of bits in a number.
- Python | Generate random number using numpy library.
- Generate random integers between 0 and 9 in Python
- Python | Program to calculate n-th term of a Fibonacci Series
- Python program for sum of square of first N natural numbers
- Python program for sum of cube of first N natural numbers
- Python program to check prime number
- Python program to find the largest prime factor of a number
- Python program to find prime numbers using sieve of Eratosthenes
- Python program to calculate prime numbers (using different algorithms) upto n
- Python program to print all prime numbers in an interval
- Python program to print all positive or negative numbers in a range
- Python program for not None test
- Python program for pass statement
- Python program for Zip, Zap and Zoom game
- Python program to convert temperature from Celsius to Fahrenheit and vice-versa
- Python program to find the number of required bits to represent a number in O(1) complexity
- Python program to count number of trailing zeros in Factorial of number N
- Python program for swapping the value of two integers
- Python program for swapping the value of two integers without third variable
- Python program to find winner of the day
- Python program for Tower of Hanoi
- Python program to find standard deviation
- Python program to find the variance
- Python program Tower of Hanoi (modified)
- Python program to convert Centimeter to Inches
- Python program to convert meters into yards
- Python program to convert yards into meters
- Python program to capitalize the character without using a function
- Python program to lowercase the character without using a function
- Python program to find perfect number
- Python program to print perfect numbers from the given list of integers
- Python program to find greatest integer using floor() method
- Python program to find the maximum EVEN number
- Python program to find the maximum ODD number
- Python program to find the solution of a special sum series
- Python | Convert the binary number to decimal without using library function
- Python | Convert the decimal number to binary without using library function
- Create a stopwatch using Python
- Python program to find the maximum multiple from given N numbers
- Python program to find the least multiple from given N numbers
- Find the root of the quadratic equation in Python
- Python program to check the given Date is valid or not
- Python program to print the calendar of any year
Comments and Discussions!
Load comments ↻