Skip to content

Commit 9745cb1

Browse files
committed
BMI-Calculator-Added
1 parent 1e8a781 commit 9745cb1

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed

Python/BMICalculator/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# BMI Calculator in Python
2+
3+
## What it does?
4+
5+
* Enter your height in feet and inches.
6+
* Enter your weight in kgs.
7+
* The script will return your BMI.
8+
9+
## How to Run?
10+
11+
* Download this folder in your system.
12+
* `cd` into the folder.
13+
* Run `pip install -r requirements.txt` to get all dependencies.
14+
* Run `python3 bmi-calculator.py`
15+
16+
## Output
17+
18+
![image](images/bmi-calculator.png)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from colorama import Fore, init
2+
3+
init(autoreset=True)
4+
5+
feet, inches = map(int, input(Fore.CYAN + "\nEnter height in feet and inches (example 5'3''): ")[:-2].split("'"))
6+
weight = float(input(Fore.CYAN + "Enter your weight in kgs: "))
7+
8+
height = float(feet*0.3048 + inches*0.0254)
9+
bmi = round(weight / (height*height), 2)
10+
print("\nYour BMI is: ", bmi)
11+
12+
if bmi<15.00:
13+
print(Fore.RED + "\nYou are very severely underweight!!!\n")
14+
elif bmi<16.00:
15+
print(Fore.RED + "\nYou are severely underweight!!\n")
16+
elif bmi<18.50:
17+
print(Fore.BLUE + "\nYou are Underweight!\n")
18+
elif bmi<25.00:
19+
print(Fore.GREEN + "\nYou are healty!\n")
20+
elif bmi<30.00:
21+
print(Fore.BLUE + "\nYou are Overweight!\n")
22+
elif bmi<35.00:
23+
print(Fore.RED + "\nYou are moderately Obese!\n")
24+
elif bmi<40.00:
25+
print(Fore.RED + "\nYou are severely Obese!!\n")
26+
else:
27+
print(Fore.RED + "\nYou are very severely Obese!!!\n")
39.8 KB
Loading

Python/BMICalculator/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
colorama==0.4.3

0 commit comments

Comments
 (0)