Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented a training coach feature #912

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions Beginner_Projects/Coach/Coach.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
users = {}
workouts = [
{"workout_type": "Push Up", "duration": 30, "calories": 100, "level": "Beginner"},
{"workout_type": "Squat", "duration": 30, "calories": 120, "level": "Beginner"},
{"workout_type": "Lunges", "duration": 30, "calories": 130, "level": "Beginner"},
{"workout_type": "Jumping Jack", "duration": 30, "calories": 150, "level": "Beginner"},
{"workout_type": "Sit Up", "duration": 30, "calories": 100, "level": "Beginner"},
{"workout_type": "Plank", "duration": 30, "calories": 80, "level": "Beginner"},
{"workout_type": "Glute Bridge", "duration": 30, "calories": 90, "level": "Beginner"},
{"workout_type": "Bicycle Crunch", "duration": 30, "calories": 110, "level": "Beginner"},
{"workout_type": "Wall Sit", "duration": 30, "calories": 70, "level": "Beginner"},
{"workout_type": "Tricep Dips", "duration": 30, "calories": 120, "level": "Beginner"},

{"workout_type": "Burpee", "duration": 30, "calories": 150, "level": "Intermediate"},
{"workout_type": "Mountain Climber", "duration": 30, "calories": 160, "level": "Intermediate"},
{"workout_type": "Kettlebell Swing", "duration": 30, "calories": 200, "level": "Intermediate"},
{"workout_type": "Tricep Dips", "duration": 30, "calories": 120, "level": "Intermediate"},
{"workout_type": "Bicycle Crunches", "duration": 30, "calories": 110, "level": "Intermediate"},
{"workout_type": "High Knees", "duration": 30, "calories": 150, "level": "Intermediate"},
{"workout_type": "Push Press", "duration": 30, "calories": 180, "level": "Intermediate"},
{"workout_type": "Box Jump", "duration": 30, "calories": 230, "level": "Intermediate"},
{"workout_type": "Jump Rope", "duration": 30, "calories": 200, "level": "Intermediate"},
{"workout_type": "Plank Jacks", "duration": 30, "calories": 140, "level": "Intermediate"},

{"workout_type": "Running", "duration": 30, "calories": 300, "level": "Advanced"},
{"workout_type": "Deadlift", "duration": 30, "calories": 250, "level": "Advanced"},
{"workout_type": "Bench Press", "duration": 30, "calories": 200, "level": "Advanced"},
{"workout_type": "Pull Up", "duration": 30, "calories": 200, "level": "Advanced"},
{"workout_type": "Thruster", "duration": 30, "calories": 250, "level": "Advanced"},
{"workout_type": "Barbell Squat", "duration": 30, "calories": 220, "level": "Advanced"},
{"workout_type": "Plyometric Push Up", "duration": 30, "calories": 210, "level": "Advanced"},
{"workout_type": "Tire Flip", "duration": 30, "calories": 300, "level": "Advanced"},
{"workout_type": "Sled Push", "duration": 30, "calories": 280, "level": "Advanced"},
{"workout_type": "Battle Ropes", "duration": 30, "calories": 250, "level": "Advanced"},
]

def register_user(username, level):
if username in users:
print("Username already exists.")
else:
users[username] = {"level": level, "progress": 0}
print("User registered successfully!")

def log_workout(username, workout_type):
if username not in users:
print("User not found.")
return

workout = next((w for w in workouts if w["workout_type"].lower() == workout_type.lower()), None)

if workout:
users[username]["progress"] += workout["calories"]
print(f"Workout '{workout['workout_type']}' logged! Calories burned: {workout['calories']}")
else:
print("Workout type not found.")

def view_user_progress(username):
if username in users:
user = users[username]
print(f"\nUser: {username}\nLevel: {user['level']}\nTotal Calories Burned: {user['progress']}\n")
else:
print("User not found.")

def list_workouts():
print("\nAvailable Workouts:")
for workout in workouts:
print(f"- {workout['workout_type']} (Calories: {workout['calories']}, Level: {workout['level']})")
print()

def main():
while True:
print("\nFitness Tracker")
print("1. Register User")
print("2. Log Workout")
print("3. View Progress")
print("4. List Available Workouts")
print("5. Exit")

choice = input("Choose an option: ")

if choice == '1':
username = input("Enter username: ")
level = input("Enter fitness level (Beginner/Intermediate/Advanced): ")
register_user(username, level)

elif choice == '2':
username = input("Enter your username: ")
list_workouts()
workout_type = input("Enter workout type: ")
log_workout(username, workout_type)

elif choice == '3':
username = input("Enter your username: ")
view_user_progress(username)

elif choice == '4':
list_workouts()

elif choice == '5':
print("Thank you for using the Fitness Tracker! Goodbye!")
break

else:
print("Invalid choice, please try again.")

if __name__ == "__main__":
main()
21 changes: 21 additions & 0 deletions Beginner_Projects/Coach/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# COACH

## Overview
FitTrack is a Python-based fitness tracker designed to help users log workouts, track progress, and stay motivated. With a variety of workouts organized by fitness level, FitTrack makes it easy to find the right exercises for your fitness journey.

## What I've Done
- Created an in-memory user and workout management system.
- Developed a comprehensive list of workouts categorized by fitness levels: Beginner, Intermediate, and Advanced.
- Implemented features for user registration, workout logging, and progress tracking.

## Libraries Used
None (the program uses built-in Python data structures for storage).

## What the Code Does
- User Management: Registers users with unique usernames and tracks their progress.
- Workout Logging: Allows users to log various workouts and tracks calories burned.
- Progress Tracking: Displays total calories burned and user statistics.
- Workout Listing: Provides a list of available workouts with details on calories and fitness level.

## Conclusion
FitTrack is a user-friendly tool for anyone looking to enhance their fitness journey. With a diverse range of workouts and straightforward progress tracking, achieving fitness goals has never been easier!
Loading