forked from DLiSWE/PythonStuff
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBMICalc.py
More file actions
116 lines (99 loc) · 3.95 KB
/
Copy pathBMICalc.py
File metadata and controls
116 lines (99 loc) · 3.95 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
underweight = range(1, 20)
normal = range(20, 26)
aboveavg = range(26, 31)
obese = range(31, 40)
class fact:
def shee(*args):
try:
askweight = int(input("Enter your weight in pounds:"))
except ValueError:
print("Enter a number")
except TypeError:
print("One of your inputs is not a number")
except ZeroDivisionError:
print("You don't weigh 0")
else:
return askweight
def eesh(*args):
try:
askheight = int(input("Enter height in inches:"))
except ValueError:
print("Enter a number")
except TypeError:
print("One of your inputs is not a number")
except ZeroDivisionError:
print("You entered 0 for either inputs")
else:
return askheight
class BMI:
def __init__(self, weight, height):
self.weight = weight
self.height = height
def vari(weight, height):
try:
x = int(703 * (weight / (height ** 2)))
except ValueError:
print("Variable is not a number")
except TypeError:
print("Values are incompatible, check your input")
except ZeroDivisionError:
print("You inputed a 0")
else:
return x
def shtalk(vari):
if vari in underweight:
print("You are underweight. Nurish yourself food please.")
elif vari in normal:
print("You average, keep it up.")
elif vari in aboveavg:
print("You're either slightly overweight or quite muscular")
elif vari in obese:
print("You are likely obese or very muscular.")
elif vari > 41:
print("Theres a problem with the program or you're extremely obese")
else:
return shtalk
class funke:
def diff(*args):
if BMI.vari(kiya, kiki) in underweight:
ok = underweight[-1]
top1 = ok - BMI.vari(kiya, kiki)
tweight1 = (top1 / 703) * height ** 2
print(
"You will need to gain" + " " + tweight1 + "pounds to go up a tier. You shouldnt try to lose more weight")
elif BMI.vari(kiya, kiki) in normal:
ok = normal[-1]
ko = normal[2]
top1 = ok - BMI.vari(kiya, kiki)
bottom1 = BMI.vari(kiya, kiki) - ko
tweight1 = (top1 / 703) * height ** 2
bweight1 = (bottom1 / 703) * height ** 2
print("You will need to gain" + " " + tweight1 + "pounds to go up a tier and lose " + bweight1
+ " to go down a pound")
elif BMI.vari(kiya, kiki) in aboveavg:
ok = aboveavg[-1]
ko = aboveavg[2]
top1 = ok - BMI.vari(kiya, kiki)
bottom1 = BMI.vari(kiya, kiki) - ko
tweight1 = (top1 / 703) * height ** 2
bweight1 = (bottom1 / 703) * height ** 2
print("You will need to gain" + " " + tweight + "pounds to go up a tier and lose " + bweight1 +
" to go down a pound")
elif BMI.vari(kiya, kiki) in obese:
ok = obese[-1]
ko = obese[2]
top1 = ok - BMI.vari(kiya, kiki)
bottom1 = BMI.vari(kiya, kiki) - ko
tweight1 = (top1 / 703) * height ** 2
bweight1 = (bottom1 / 703) * height ** 2
print("You will need to gain" + " " + tweight + "pounds to go up a tier and lose " + bweight1 +
" to go down a pound")
else:
ok = obese[-1]
bottom1 = BMI.vari(kiya, kiki) - ok
bweight1 = (bottom1 / 703) * height ** 2
print("You will need to lose" + " " + bweight + "pounds to go down a tier and you really should")
kiya = fact.shee()
kiki = fact.eesh()
print("Your BMI is" + " " + str(BMI.vari(kiya, kiki)))
print(str(BMI.shtalk(BMI.vari(kiya, kiki))))