Mini Project: CLI To-Do App
Build a command-line To-Do app using lists, functions, and loops. This project brings together everything from Modules 1-4.
25 min•By Priygop Team•Updated 2026
CLI To-Do App
CLI To-Do App
# Simple CLI To-Do App
def show_menu():
print("\n=== TO-DO APP ===")
print("1. View tasks")
print("2. Add task")
print("3. Complete task")
print("4. Remove task")
print("5. Exit")
def view_tasks(tasks):
if not tasks:
print("\n No tasks yet!")
return
print("\n Your Tasks:")
for i, task in enumerate(tasks, 1):
status = "✅" if task["done"] else "⬜"
print(f" {i}. {status} {task['title']}")
def add_task(tasks, title):
tasks.append({"title": title, "done": False})
print(f" Added: {title}")
def complete_task(tasks, index):
if 0 <= index < len(tasks):
tasks[index]["done"] = True
print(f" Completed: {tasks[index]['title']}")
else:
print(" Invalid task number!")
def remove_task(tasks, index):
if 0 <= index < len(tasks):
removed = tasks.pop(index)
print(f" Removed: {removed['title']}")
else:
print(" Invalid task number!")
# Demo run (simulated — no input())
tasks = []
add_task(tasks, "Learn Python basics")
add_task(tasks, "Practice list operations")
add_task(tasks, "Build a project")
view_tasks(tasks)
complete_task(tasks, 0)
view_tasks(tasks)
remove_task(tasks, 2)
view_tasks(tasks)
print(f"\nTotal: {len(tasks)} tasks, {sum(1 for t in tasks if t['done'])} completed")Try It Yourself: Extend the App
Try It Yourself: Extend the AppPython
Python Editor
✓ ValidTab = 2 spaces
Python|32 lines|653 chars|✓ Valid syntax
UTF-8
Tip
Tip
Use list of dicts for structured data: [{'title': 'task', 'done': False}]. It's cleaner than parallel lists and easier to extend.
Diagram
Loading diagram…
Everything in Python is an object — use type() to check
Common Mistake
Warning
Modifying list indices without bounds checking causes IndexError. Always validate: if 0 <= index < len(tasks): before accessing.
Practice Task
Note
(1) Add a priority field to tasks. (2) Sort tasks by priority. (3) Add a search function. (4) Count completed vs pending tasks.