Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/qtle3/bmi_calculator

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.
https://github.com/qtle3/bmi_calculator

arithmetic-operations conditional-statements functions string-formatting type-conversion user-input

Last synced: 12 days ago
JSON representation

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.

Awesome Lists containing this project

README

        

# 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.