Skip to content

Instantly share code, notes, and snippets.

@arsenstorm
Created July 6, 2021 09:21
Show Gist options
  • Save arsenstorm/4ab81e153147d365dab37b0fa7c9f052 to your computer and use it in GitHub Desktop.
Save arsenstorm/4ab81e153147d365dab37b0fa7c9f052 to your computer and use it in GitHub Desktop.
activities = ["Running", "Swimming", "Tennis", "Football"]
timeExercise = []
number = 0
for i in range(len(activities)):
timeAppend = -1
act = activities[i]
while True:
try:
while timeAppend < 0 or timeAppend > 200:
timeAppend = int(input("How many minutes do you spend exercising for " + str(act) + "\n>>> "))
break
except ValueError:
print(">>> You must enter an integer")
timeExercise.append(timeAppend)
for i in range(len(timeExercise)):
number = number + int(timeExercise[i])
average = number/len(activities)
print("\n")
print("Total time exercising -->", number)
print("Average time per exercise -->", average)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment