Member-only story
Create Your Own Gym Tool Using Python
Are you a fitness enthusiast who loves coding? Let’s build a simple gym tool using Python to track workouts, manage exercises, and calculate progress.
---
### What We’ll Build
Our tool will:
1. Store exercises (name, duration, calories burned).
2. Let users log daily workouts.
3. Show workout history and total calories burned.
---
### Step 1: Set Up the Basics
Create a class to represent each exercise:
```python
class Exercise:
def __init__(self, name, duration, calories):
self.name = name
self.duration = duration # in minutes
self.calories = calories # calories burned
```
---
### Step 2: Create a Workout Plan
Build a class to manage exercises and track workouts:
```python
class WorkoutPlan:
def __init__(self):
self.workouts = [] # List to store exercises
self.history = [] # List to store daily logs