-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBMI.py
More file actions
37 lines (26 loc) · 826 Bytes
/
BMI.py
File metadata and controls
37 lines (26 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class BMI():
def __init__(self):
self.mass = None
self.height = None
def calcBmi(self,mass,height):
return round(mass / ((height / 100) ** 2),ndigits=1)
def identifyCategory(self,bmi):
if (0 < bmi <= 16):
return 'Severely Underweight'
elif (16 < bmi <= 18.5):
return 'Underweight'
elif (18.5 < bmi <= 25):
return 'Normal'
elif (25 < bmi < 30):
return 'Overwight'
elif (30 < bmi):
return 'Obese'
else:
return 'why r u gai'
def notify(self,mass,height):
self.mass = mass
self.height = height
bmi = self.calcBmi(self.mass,self.height)
return bmi,self.identifyCategory(bmi)
b = BMI()
print(b.notify(65,190))