forked from Mrinank-Bhowmick/python-beginner-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
39 lines (33 loc) · 1.09 KB
/
main.py
File metadata and controls
39 lines (33 loc) · 1.09 KB
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
38
39
from pywebio.input import *
from pywebio.output import *
class calculation:
def BMIcalculator(Height, Mass):
for t1, t2 in [
(16, "severely underweight"),
(18.5, "underweight"),
(25, "normal"),
(30, "overweight"),
(35, "moderately obese"),
(float("inf"), "severely obese"),
]:
if BMI <= t1:
put_text("Your BMI is", BMI, "and the person is :", t2)
break
class calculation:
def BMIcalculator(self, Height, Mass):
BMI = (Mass) / (Height * Height)
for t1, t2 in [
(16, "severely underweight"),
(18.5, "underweight"),
(25, "normal"),
(30, "overweight"),
(35, "moderately obese"),
(float("inf"), "severely obese"),
]:
if BMI <= t1:
put_text("Your BMI is", BMI, "and the person is :", t2)
break
Height = input("Enter Height(m)", type=FLOAT)
Mass = input("Enter Weight(Kg)", type=FLOAT)
obj = calculation()
obj.BMIcalculator(Height, Mass)