-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathweight.py
93 lines (68 loc) · 2.16 KB
/
weight.py
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 25 18:10:27 2019
@author: william keilsohn
"""
# Based off of 4chan's weight loss callorie program:
# Import Packages:
#import numpy as np
# Define A Class for the possiblities:
class WCalc:
def __init__(self, weight = 0):
self.weight = weight
gain_mussle_vals = [16, 18]
loose_fat_vals = [10, 12]
maintain_vals = [14, 15]
def getUserWeight(self):
self.weight = int(input('Please enter your current weight (lb): '))
def looseWeight(self):
loose_cals = list(map(lambda x: self.weight * x, self.loose_fat_vals))
print(loose_cals)
def maintainWeight(self):
same_cals = list(map(lambda x: self.weight * x, self.maintain_vals))
print(same_cals)
def gainMusscle(self):
gain_cals = list(map(lambda x: self.weight * x, self.gain_mussle_vals))
print(gain_cals)
# Facilitate user experiance:
class User:
def __init__(self, run = True):
self.run = run
yes_vals = ['Yes', 'yes', 'y', 'Y', 'Yup', 'yis', 'YES']
sel_vlas = '''Please select one of the following options by entering its number:
0) Loose Weight
1) Maintain Weight
2) Gain Mussle
'''
def setRun(self):
user_anser = input("Would you like to continue? ")
if user_anser in self.yes_vals:
self.run = True
else:
self.run = False
def getRun(self):
return self.run
def sortCalc(self, obj):
print(self.sel_vlas)
user_anser = int(input("Enter your selection here: "))
print('\n')
if user_anser == 0:
obj.looseWeight()
elif user_anser == 1:
obj.maintainWeight()
else:
obj.gainMusscle()
# Make a few objects
c1 = WCalc()
u1 = User()
# Get user Weight:
c1.getUserWeight()
# Ask followup questions and run analysis
while u1.run:
print('\n')
u1.sortCalc(c1)
print('\n')
u1.setRun()
# End process
print("Thank you for using my tool.")