-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInteractive_calorie_tracker_and_calculator.txt
More file actions
135 lines (110 loc) · 4.25 KB
/
Interactive_calorie_tracker_and_calculator.txt
File metadata and controls
135 lines (110 loc) · 4.25 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#Semi-Complex calorie calculator/weightloss calculator
#interactive dictionary with values
#Dict_format {'Food':calories'}
#Work in progress<-------------------------------------
Age = 0
bmr = 0
GenderConstant = 0
Height = 0
ActivityConstant = 0
Weight = 0
CalorieNeeds = 0
Calorie_Input = {'Banana':105}
AgeQuestion = True
while AgeQuestion:
Age = int(input('What is your age? '))#breaks with special characters and strings Issue with loop structure possibly?...
if Age > 0 and Age < 123:
AgeQuestion = False
continue
elif Age == 123:
AgeQuestion = False
print('Are you the current record holder? You are quite old!')
continue
else:
print(" ") #formating
print("I think your age might be off! Please try again!")
print(" ") #formating
print(" ")#formating
print(Age)
print(" ")#formating
Genderquestion = True #Need to ask gender to calculate base metabolic rate
while Genderquestion:
Gender = input("Are you a boy or girl? ") #breaks with strings that have overlap ex: 'male' and fe'male' and int Issue with loop structure possibly?...
if Gender == 'Boy' or Gender == 'boy':
GenderConstant = 5
Genderquestion = False
print(" ")#formating
continue
elif Gender == 'Girl' or Gender == 'girl':
GenderConstant = -161
Genderquestion = False
print(" ") #formating
continue
else:
print(" ") #formating
print("Please try again, make sure you type the answer exactly as written in the question!")
print(" ") #formating
print(" ")#formating
print(GenderConstant)
print(" ")#formating
Weightquestion = True #Need to ask weight to calculate base metabolic rate
while Weightquestion:
Weight = int(input("What is your weight in kilograms? ")) #breaks with strs and special characters example: ,.;'!@#$ Issue with loop structure possibly?...
if Weight > 0 and Weight < 2000:
Weightquestion = False
print(" ")#formating
continue
elif Weight >= 2000:
print("At that weight I think you may need to consult a doctor not this program! ")
Weightquestion = False
continue
else:
print(" ") #formating
print("At that weight I think you may need to consult a doctor not this program! ")
print(" ") #formating
print(Weight)
Heightquestion = True #Need to ask height to calculate base metabolic rate
while Heightquestion:
print(" ")#formating
Height = int(input("How tall are you in cm? (1 foot = 30.48cm!) "))#breaks with strs and special characters Issue with loop structure possibly?...
if Height > 0 and Height < 272.034:
print(" ")#formating
Heightquestion = False
continue
elif Height == 272.034:
print(" ")#formating
print("Hello worlds tallest man!")
print(" ")#formating
Heightquestion = False
continue
else:
print(" ") #formating
print("I think your height might be a tad off!")
print(" ") #formating
Activityquestion = True #Need to ask activity to calculate base metabolic rate
while Heightquestion:
print(" ")#formating
ActivityLevel = input("How active are you ")#breaks with ints and special characters example: 12, 3, 4 or @!#!';..,;';%&* Issue with loop structure possibly?...
if Height > 0 and Height < 272.034:
print(" ")#formating
Heightquestion = False
continue
elif Height == 272.034:
print(" ")#formating
print("Hello worlds tallest man!")
print(" ")#formating
Heightquestion = False
continue
else:
print(" ") #formating
print("I think your height might be a tad off!")
print(" ") #formating
#For men: BMR = 10 × weight(kg) + 6.25 × height(cm) - 5 × age(y) + 5
#For women BMR = 10 × weight(kg) + 6.25 × height(cm) - 5 × age(y) - 161
print(Height)#formating
print(" ")
bmr = 10 * Weight + 6.25 * Height - 5 * Age - GenderConstant
print('The amount of calories required to maintain your current weight is ',+CalorieNeeds )
print(" ")#formating
print(Calorie_Input['Banana'])
input("Press<enter>ToEnd")