11-15-2025, 10:47 PM
Chapter 20 — Final Project: Your First Complete Python Application
This is your capstone. You’ll build a structured, multi-file Python application with real features, clean organisation, and user interaction — just like real software engineers do.
This final chapter brings all skills together:
• variables
• loops
• functions
• modules
• classes
• file handling
• data persistence
• input validation
• project architecture
By the end, you will have:
A complete, professional-looking Python program.
---
20.1 What You’re Building
THE PERSONAL TASK MANAGER
A command-line app where users can:
• add tasks
• list tasks
• mark tasks as done
• delete tasks
• auto-save everything to a JSON file
• load tasks when the program starts
• structured cleanly across multiple files
It behaves like a real utility tool — small, neat, and genuinely useful.
---
20.2 Project Structure
Create a folder:
task_manager/
Inside, create these files:
---
20.3 The Data Model (tasks.py)
---
20.4 File Storage System (storage.py)
---
20.5 The Menu System (menu.py)
---
20.6 Main Program (main.py)
---
20.7 Optional Upgrades
Try adding:
• deadlines
• categories
• coloured output
• priority rankings
• sorting features
• search system
• export tasks to text file
• encryption (advanced)
---
20.8 Summary — You’ve Built Real Software
In this final project, you:
• wrote multi-file code
• used classes & objects
• handled persistent data
• designed a menu system
• used JSON for storage
• built an actual working app
You now have the skills to:
• write tools
• build games
• analyse data
• automate tasks
• prepare for GUI & web apps
You have completed:
Beginner’s Guide to Coding — Python From Zero to Skill
Your next step is the Intermediate Python course.
---
Written and Compiled by Lee Johnston — Founder of The Lumin Archive
This is your capstone. You’ll build a structured, multi-file Python application with real features, clean organisation, and user interaction — just like real software engineers do.
This final chapter brings all skills together:
• variables
• loops
• functions
• modules
• classes
• file handling
• data persistence
• input validation
• project architecture
By the end, you will have:
A complete, professional-looking Python program.
---
20.1 What You’re Building
THE PERSONAL TASK MANAGER
A command-line app where users can:
• add tasks
• list tasks
• mark tasks as done
• delete tasks
• auto-save everything to a JSON file
• load tasks when the program starts
• structured cleanly across multiple files
It behaves like a real utility tool — small, neat, and genuinely useful.
---
20.2 Project Structure
Create a folder:
task_manager/
Inside, create these files:
Code:
task_manager/
main.py
tasks.py
storage.py
menu.py
tasks.json---
20.3 The Data Model (tasks.py)
Code:
class Task:
def __init__(self, text, done=False):
self.text = text
self.done = done
def mark_done(self):
self.done = True
def to_dict(self):
return {"text": self.text, "done": self.done}
@staticmethod
def from_dict(data):
return Task(data["text"], data["done"])---
20.4 File Storage System (storage.py)
Code:
import json
from tasks import Task
FILENAME = "tasks.json"
def load_tasks():
try:
with open(FILENAME, "r") as f:
data = json.load(f)
return [Task.from_dict(item) for item in data]
except FileNotFoundError:
return []
def save_tasks(tasks):
with open(FILENAME, "w") as f:
json.dump([t.to_dict() for t in tasks], f, indent=2)---
20.5 The Menu System (menu.py)
Code:
def show_menu():
print("\n=== TASK MANAGER ===")
print("1. View tasks")
print("2. Add task")
print("3. Complete task")
print("4. Delete task")
print("5. Exit")
return input("> ")---
20.6 Main Program (main.py)
Code:
from tasks import Task
from storage import load_tasks, save_tasks
from menu import show_menu
tasks = load_tasks()
while True:
choice = show_menu()
if choice == "1":
print("\n--- TASK LIST ---")
if not tasks:
print("No tasks yet.")
for i, t in enumerate(tasks):
status = "✓" if t.done else "✗"
print(f"{i+1}. [{status}] {t.text}")
elif choice == "2":
text = input("Enter new task: ").strip()
if text:
tasks.append(Task(text))
save_tasks(tasks)
print("Task added.")
elif choice == "3":
num = int(input("Mark which task as done? "))
if 1 <= num <= len(tasks):
tasks[num-1].mark_done()
save_tasks(tasks)
print("Task completed.")
elif choice == "4":
num = int(input("Delete which task? "))
if 1 <= num <= len(tasks):
tasks.pop(num-1)
save_tasks(tasks)
print("Task deleted.")
elif choice == "5":
print("Goodbye!")
break
else:
print("Invalid option.")---
20.7 Optional Upgrades
Try adding:
• deadlines
• categories
• coloured output
• priority rankings
• sorting features
• search system
• export tasks to text file
• encryption (advanced)
---
20.8 Summary — You’ve Built Real Software
In this final project, you:
• wrote multi-file code
• used classes & objects
• handled persistent data
• designed a menu system
• used JSON for storage
• built an actual working app
You now have the skills to:
• write tools
• build games
• analyse data
• automate tasks
• prepare for GUI & web apps
You have completed:
Beginner’s Guide to Coding — Python From Zero to Skill
Your next step is the Intermediate Python course.
---
Written and Compiled by Lee Johnston — Founder of The Lumin Archive
