File tree Expand file tree Collapse file tree 4 files changed +53
-0
lines changed Expand file tree Collapse file tree 4 files changed +53
-0
lines changed Original file line number Diff line number Diff line change
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 )
Original file line number Diff line number Diff line change
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 + "\n Enter 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 ("\n Your BMI is: " , bmi )
16
+
17
+ # Interpreting the result based on value of BMI
18
+
19
+ if bmi < 15.00 :
20
+ print (Fore .RED + "\n You are very severely underweight!!!\n " )
21
+ elif bmi < 16.00 :
22
+ print (Fore .RED + "\n You are severely underweight!!\n " )
23
+ elif bmi < 18.50 :
24
+ print (Fore .BLUE + "\n You are Underweight!\n " )
25
+ elif bmi < 25.00 :
26
+ print (Fore .GREEN + "\n You are healty!\n " )
27
+ elif bmi < 30.00 :
28
+ print (Fore .BLUE + "\n You are Overweight!\n " )
29
+ elif bmi < 35.00 :
30
+ print (Fore .RED + "\n You are moderately Obese!\n " )
31
+ elif bmi < 40.00 :
32
+ print (Fore .RED + "\n You are severely Obese!!\n " )
33
+ else :
34
+ print (Fore .RED + "\n You are very severely Obese!!!\n " )
Original file line number Diff line number Diff line change
1
+ colorama == 0.4.3
You can’t perform that action at this time.
0 commit comments