Back to projects
PythonBeginner–Intermediate1 session
Homework Tracker
A lightweight personal organizer that stores tasks while the program is open. It teaches students how lists and dictionaries can represent real information without requiring accounts or a backend.
Starter code
Read it. Run it. Change it.
Save the code below as homework_tracker.py. The example is intentionally small enough for a student to explain line by line before adding new features.
homework_tracker.pyPython
tasks = []
def show_tasks():
if not tasks:
print("No homework added yet.")
return
for number, task in enumerate(tasks, start=1):
mark = "✓" if task["done"] else " "
print(f"{number}. [{mark}] {task['name']}")
while True:
print("\n1. Add homework")
print("2. View homework")
print("3. Mark complete")
print("4. Exit")
choice = input("Choose: ")
if choice == "1":
name = input("Homework: ")
tasks.append({"name": name, "done": False})
elif choice == "2":
show_tasks()
elif choice == "3":
show_tasks()
number = int(input("Task number completed: "))
if 1 <= number <= len(tasks):
tasks[number - 1]["done"] = True
elif choice == "4":
break
else:
print("Please choose 1, 2, 3, or 4.")How to run it on a laptop
- 1. Install Python 3 if it is not already available.
- 2. Open IDLE, Thonny, VS Code, or any simple text editor.
- 3. Copy the code into a new file named
homework_tracker.py. - 4. Run the file. No internet connection, database, or server is required.
Build it step by step
1
Represent a task
Use a dictionary to keep both the task name and completion status.
2
Collect tasks
Store each dictionary in a list.
3
Build actions
Create menu choices for adding, viewing, and completing homework.
4
Update information
Change a task's done value when the student finishes it.
Make it your own
- Add a subject to each homework task.
- Add a due-date field.
- After learning files, save tasks so they remain after the program closes.