This repository was archived by the owner on Apr 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import tabulate
2+ import csv
3+
4+ def reference_chart ():
5+ """
6+ This is a function used to tabulate the data
7+ of the bmi scale for the user, this requries a csv file 'bmi.csv' and two libraries "csv" and "tabulate".
8+ It won't take any arguments and won't return anything
9+ """
10+ list2 = []
11+ with open ('bmi.csv' ) as file1 :
12+ list1 = csv .reader (file1 )
13+ for line in list1 :
14+ list2 .append (line )
15+ print ("Here You can take the reference chart \n " )
16+ print (tabulate .tabulate (list2 [1 :],headers = list2 [0 ],tablefmt = 'fancy_grid' ))
17+
18+
119def calculate_bmi (height , weight ):
220 """
321 Calculate BMI given height (in meters) and weight (in kilograms).
@@ -44,6 +62,7 @@ def interpret_bmi(bmi):
4462
4563
4664def main ():
65+ reference_chart ()
4766 try :
4867 height = float (input ("Enter your height in meters: " ))
4968 weight = float (input ("Enter your weight in kilograms: " ))
Original file line number Diff line number Diff line change 1+ ranges , condition
2+ <18.5 , underweight
3+ 18.5 - 24.9 , normal
4+ 24.9 - 29.9 , overweight
5+ 29.9 - 34.9 , obese (Class I)
6+ 34.9 - 39.9 , obese (Class II)
7+ 39.9< , obese (Class III)
Original file line number Diff line number Diff line change 1+ 1.tabulate
2+ 2.csv
You can’t perform that action at this time.
0 commit comments