Skip to content

Commit 356aeca

Browse files
Fix the next loop
1 parent 1b7b663 commit 356aeca

File tree

1 file changed

+33
-34
lines changed

1 file changed

+33
-34
lines changed

main.py

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def openvideo():
7979
exit()
8080
break
8181
else:
82-
print("Sorry that is incorrect. Please try again!")
82+
print("Sorry that is incorrect. Please try again! \n")
8383
run_options = True
8484

8585
# Ask What They Want to Do
@@ -90,39 +90,31 @@ def openvideo():
9090
if select == "abs":
9191
for i in range(len(abs)):
9292
print(str(i+1) + ". " + str(abs[i]) + "\t 2 Sets of " + str(abs_count[i]) + " Reps")
93-
print("")
9493
elif select == "quads":
9594
for i in range(len(quads)):
9695
print(str(i+1) + ". " + str(quads[i]) + "\t 2 Sets of " + str(quads_count[i]) + " Reps")
97-
print("")
9896
elif select == "glutes":
9997
for i in range(len(glutes)):
10098
print(str(i+1) + ". " + str(glutes[i]) + "\t 2 Sets of " + str(glutes_count[i]) + " Reps")
101-
print("")
10299
elif select == "triceps":
103100
for i in range(len(glutes)):
104101
print(str(i+1) + ". " + str(triceps[i]) + "\t 2 Sets of " + str(triceps_count[i]) + " Reps")
105-
print("")
106102
elif select == "biceps":
107103
for i in range(len(biceps)):
108104
print(str(i+1) + ". " + str(biceps[i]) + "\t 2 Sets of " + str(biceps_count[i]) + " Reps")
109-
print("")
110105
elif select == "back":
111106
for i in range(len(back)):
112107
print(str(i+1) + ". " + str(back[i]) + "\t 2 Sets of " + str(back_count[i]) + " Reps")
113-
print("")
114108
elif select == "chest":
115109
for i in range(len(chest)):
116110
print(str(i+1) + ". " + str(chest[i]) + "\t 2 Sets of " + str(chest_count[i]) + " Reps")
117-
print("")
111+
print("")
118112
run_activity = True
119113
elif activity.lower() == "start":
120114
global activity_num
121-
global start_time
122-
start_time = date.today()
123115
activity_num = 0
124116
print("You have started the " + select + " muscle group. ")
125-
print("The current time is: " + str(time.strftime("%H:%M:%S")) + " - " + str(date.today()-start_time) + " has elapsed.")
117+
print("The current time is: " + str(time.strftime("%H:%M:%S")))
126118
if select == "abs":
127119
print("You have completed: " + str((int(activity_num/len(abs_count)))) + "%")
128120
print("Please complete 2 Sets of " + str(abs_count[activity_num]) + " Reps of " + str(abs[activity_num]))
@@ -148,29 +140,35 @@ def openvideo():
148140
activity_num = activity_num + 1
149141
run_activity = True
150142
elif activity.lower() == "next":
151-
print("You are in the " + select + " muscle group. ")
152-
print("The current time is: " + str(time.strftime("%H:%M:%S")) + " - " + str(date.today()-start_time) + " has elapsed.")
153-
if select == "abs":
154-
print("You have completed: " + str((int(activity_num/len(abs_count)))) + "%")
155-
print("Please complete 2 Sets of " + str(abs_count[activity_num]) + " Reps of " + str(abs[activity_num]))
156-
elif select == "quads":
157-
print("You have completed: " + str((int(activity_num/len(quads_count)))) + "%")
158-
print("Please complete 2 Sets of " + str(quads_count[activity_num]) + " Reps of " + str(quads[activity_num]))
159-
elif select == "glutes":
160-
print("You have completed: " + str((int(activity_num/len(glutes_count)))) + "%")
161-
print("Please complete 2 Sets of " + str(glutes_count[activity_num]) + " Reps of " + str(glutes[activity_num]))
162-
elif select == "triceps":
163-
print("You have completed: " + str((int(activity_num/len(triceps_count)))) + "%")
164-
print("Please complete 2 Sets of " + str(triceps_count[activity_num]) + " Reps of " + str(triceps[activity_num]))
165-
elif select == "biceps":
166-
print("You have completed: " + str((int(activity_num/len(biceps_count)))) + "%")
167-
print("Please complete 2 Sets of " + str(biceps_count[activity_num]) + " Reps of " + str(biceps[activity_num]))
168-
elif select == "back":
169-
print("You have completed: " + str((int(activity_num/len(back_count)))) + "%")
170-
print("Please complete 2 Sets of " + str(back_count[activity_num]) + " Reps of " + str(back[activity_num]))
171-
elif select == "chest":
172-
print("You have completed: " + str((int(activity_num/len(chest_count)))) + "%")
173-
print("Please complete 2 Sets of " + str(chest_count[activity_num]) + " Reps of " + str(chest[activity_num]))
143+
while (activity_num-1) <= len(select)+1:
144+
print("You are in the " + select + " muscle group. ")
145+
print("The current time is: " + str(time.strftime("%H:%M:%S")))
146+
if select == "abs":
147+
print("You have completed: " + str((int(activity_num/len(abs_count)*100))) + "%")
148+
print("Please complete 2 Sets of " + str(abs_count[activity_num]) + " Reps of " + str(abs[activity_num]) + "\n")
149+
elif select == "quads":
150+
print("You have completed: " + str((int(activity_num/len(quads_count)*100))) + "%")
151+
print("Please complete 2 Sets of " + str(quads_count[activity_num]) + " Reps of " + str(quads[activity_num]) + "\n")
152+
elif select == "glutes":
153+
print("You have completed: " + str((int(activity_num/len(glutes_count)*100))) + "%")
154+
print("Please complete 2 Sets of " + str(glutes_count[activity_num]) + " Reps of " + str(glutes[activity_num]) + "\n")
155+
elif select == "triceps":
156+
print("You have completed: " + str((int(activity_num/len(triceps_count)*100))) + "%")
157+
print("Please complete 2 Sets of " + str(triceps_count[activity_num]) + " Reps of " + str(triceps[activity_num]) + "\n")
158+
elif select == "biceps":
159+
print("You have completed: " + str((int(activity_num/len(biceps_count)*100))) + "%")
160+
print("Please complete 2 Sets of " + str(biceps_count[activity_num]) + " Reps of " + str(biceps[activity_num]) + "\n")
161+
elif select == "back":
162+
print("You have completed: " + str((int(activity_num/len(back_count)*100))) + "%")
163+
print("Please complete 2 Sets of " + str(back_count[activity_num]) + " Reps of " + str(back[activity_num]) + "\n")
164+
elif select == "chest":
165+
print("You have completed: " + str((int(activity_num/len(chest_count)*100))) + "%")
166+
print("Please complete 2 Sets of " + str(chest_count[activity_num]) + " Reps of " + str(chest[activity_num]) + "\n")
167+
break
168+
else:
169+
print("You have just completed the last activity!")
170+
print("Run the `end` command to complete the workout. \n")
171+
run_activity = True
174172
activity_num = activity_num + 1
175173
run_activity = True
176174
elif activity.lower() == "quit":
@@ -179,4 +177,5 @@ def openvideo():
179177
break
180178
else:
181179
print("Sorry that is not an option. Please see this list of options below:")
180+
print("")
182181
run_activity = True

0 commit comments

Comments
 (0)