Skip to content

Calculate your Body Mass Index (BMI) by entering your weight and height. The Python program computes your BMI and tells you if you're within a healthy range, below it, or above it.

Notifications You must be signed in to change notification settings

qtle3/bmi_calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

BMI Calculator

Overview

This Python program calculates and evaluates the Body Mass Index (BMI) of a person based on their weight and height. The BMI is calculated using a mathematical formula, and the program determines if the BMI is within a healthy range, below, or above it.

How It Works

Functions

  1. bmi_calculator(w, h):

    • Takes weight (w) in pounds and height (h) in inches as inputs.
    • Returns the calculated BMI.
  2. BMI():

    • Prompts the user to enter their weight and height.
    • Calculates the BMI using the bmi_calculator function.
    • Prints the calculated BMI, rounded to two decimal places.
    • Determines if the BMI is within a healthy range, below, or above it, and prints the corresponding message.

Key Concepts Covered

  • Functions: How to define and use functions to organize code.
  • User Input: Collecting user input using the input() function.
  • Type Conversion: Converting user inputs to float for arithmetic operations.
  • Arithmetic Operations: Calculating BMI using a mathematical formula.
  • Conditional Statements: Using if-elif-else statements to evaluate the BMI range.
  • String Formatting: Rounding and formatting the BMI value for output.

About

Calculate your Body Mass Index (BMI) by entering your weight and height. The Python program computes your BMI and tells you if you're within a healthy range, below it, or above it.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages