Skip to content

Commit 5160612

Browse files
Merge pull request #84 from Ninjavin/ninjavin-bmi-calculator
BMI-Calculator-Added
2 parents bad85b8 + 0480235 commit 5160612

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-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: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Colorama helps adding colors to the terminal output
2+
3+
from colorama import Fore, init
4+
5+
init(autoreset=True)
6+
7+
# Getting Height and Weight of User from the input
8+
9+
height = float(input(Fore.CYAN + "\nEnter your height in metres: "))
10+
weight = float(input(Fore.CYAN + "Enter your weight in kgs: "))
11+
12+
# Calculating BMI
13+
14+
bmi = round(weight / (height*height), 2)
15+
print("\nYour BMI is: ", bmi)
16+
17+
# Interpreting the result based on value of BMI
18+
19+
if bmi<15.00:
20+
print(Fore.RED + "\nYou are very severely underweight!!!\n")
21+
elif bmi<16.00:
22+
print(Fore.RED + "\nYou are severely underweight!!\n")
23+
elif bmi<18.50:
24+
print(Fore.BLUE + "\nYou are Underweight!\n")
25+
elif bmi<25.00:
26+
print(Fore.GREEN + "\nYou are healty!\n")
27+
elif bmi<30.00:
28+
print(Fore.BLUE + "\nYou are Overweight!\n")
29+
elif bmi<35.00:
30+
print(Fore.RED + "\nYou are moderately Obese!\n")
31+
elif bmi<40.00:
32+
print(Fore.RED + "\nYou are severely Obese!!\n")
33+
else:
34+
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)