import json
import random
# Sample workout data
workouts = {
"strength": ["Push-ups", "Squats", "Lunges", "Plank", "Dumbbell Rows"],
"cardio": ["Jumping Jacks", "Burpees", "High Knees", "Mountain Climbers", "Jump Rope"],
"flexibility": ["Yoga", "Dynamic Stretching", "Static Stretching", "Foam Rolling"]
# Function to display available workouts
def display_workouts():
print("Available workout types:")
for workout_type in [Link]():
print(f"- {workout_type}")
# Function to get exercises for a chosen workout type
def get_exercises(workout_type):
return [Link](workout_type, [])
# Function to log workout to a file
def log_workout(selected_exercises):
with open("workout_log.json", "a") as log_file:
workout_entry = {
"exercises": selected_exercises,
"completed": True
[Link](workout_entry, log_file)
log_file.write("\n")
def main():
while True:
display_workouts()
workout_type = input("Choose a workout type (or type 'exit' to quit): ").lower()
if workout_type == 'exit':
break
exercises = get_exercises(workout_type)
if not exercises:
print("Invalid workout type. Please try again.")
continue
num_exercises = int(input("How many exercises would you like to do? "))
selected_exercises = [Link](exercises, min(num_exercises, len(exercises)))
print("\nYour workout:")
for exercise in selected_exercises:
print(f"- {exercise}")
log_workout(selected_exercises)
print("Workout logged successfully!\n")
if __name__ == "__main__":
main()