2 Comments
User's avatar
Edwin Guerra's avatar

Hi guys, here is my code: https://pastebin.com/gRrU65bw

Expand full comment
Sani Muhammad's avatar

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()

Expand full comment