Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/qtle3/bmi_calculator
- Owner: qtle3
- Created: 2024-08-01T04:11:38.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-08-12T04:59:55.000Z (3 months ago)
- Last Synced: 2024-08-12T05:56:18.704Z (3 months ago)
- Topics: arithmetic-operations, conditional-statements, functions, string-formatting, type-conversion, user-input
- Language: Python
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.