Project Description
This program helps you track your workout routines, sets, reps, and weights. It lets you add exercises, record your progress, and review past workouts. Perfect for gym users who want to log their progress.
How the project works
The program is command line based and it starts by letting the user choose any of the options.
At first, the user may want to add an exercise type. Here the user adds a pushup and a squat exercise:
Once the user has added a few exercise types, they can log an exercise whenever they perform that exercise. Here the user has logged in the pushups exercise, declaring 3 sets of 10 reps each and 0 as extra weight.
Finally, the user see their progress by choosing option 3. View Progress:
As you can see in the last line, the program shows that the user has done a session and it displays the details about that session.
You can use procedural or functional programming to code this project, but we used object-oriented programming in the solution in the “Show Code” button. For simplicity, we are not saving the user data in any files, but simply inside the program temporarily.
Prerequisites
Required Libraries: No libraries are needed for this project.
Required Files: No files are needed for this project.
IDE: You can use any IDE on your computer to code the project.
Danger Zone
Once you code the project, compare it with our two solutions given in the button below.
Hi guys, here is my code: https://pastebin.com/gRrU65bw
def exercise_tracker():
print("Welcome to the Exercise Tracker!")
#chosing an action type
print("Enter the number corresponding to your choice!!")
exercises = []
session = {}
while True:
user_choice = input(
"Please choose an option:\n1. Add a new exercise\n2. Log an exercise session\n3. View progress\n4. Exit the program\n")
if user_choice == "1":
exercise_type = input("Enter the name of the new exercise you want to add: ")
exercises.append(exercise_type)
print("Exercise added successfully!")
elif user_choice == "2":
if not exercises:
print("No exercises found. Please add an exercise first.")
continue
print(f"Available exercises: {exercises}")
exercise_performed = input("Enter the name of the exercise you performed: ")
if exercise_performed not in exercises:
print("This exercise is not in your list. Please add it first.")
continue
exercise_set = int(input("How many sets did you complete? "))
exercise_reps = int(input("How many reps per set? "))
weight = int(input("Enter the extra weight used (if any, otherwise enter 0): "))
print("Your session has been recorded successfully!")
session.update({
"exercise_performed": exercise_performed,
"exercise_set": exercise_set,
"exercise_reps": exercise_reps,
"weight": weight
})
elif user_choice == "3":
if session:
output = "\n".join([f"{key}: {value}" for key,value in session.items()])
print(f"\nExercise Progress Report:\n{output}\n")
break
else:
print("No exercise sessions logged yet.")
elif user_choice == "4":
exit("Thank you for using the Exercise Tracker!")
exercise_tracker()