0% found this document useful (0 votes)
87 views3 pages

Import json-WPS Office

import json

Uploaded by

mohammedkghazal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views3 pages

Import json-WPS Office

import json

Uploaded by

mohammedkghazal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

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

You might also like