Home → Projects → To-Do List

Project 03: To-Do List

Build a simple command-line task manager using Python.

Beginner Python Project 03

📌 Project Overview

In this project, you will create a simple To-Do List application. Users can add, view and remove tasks.

What you will learn:
  • Creating and using lists
  • Adding items with append()
  • Removing items
  • Creating functions
  • Using while loops
  • Using conditional statements

⚙️ To-Do List Features

➕ Add Task
📋 View Tasks
❌ Remove Task
🚪 Exit

Step 1: Create a Task List

Start with an empty list to store tasks.

Python
tasks = []

Step 2: Add a Task

The append() method adds a new task to the list.

Python
task = input("Enter a task: ")

tasks.append(task)

Step 3: Display Tasks

Use a loop to display all the tasks.

Python
for i, task in enumerate(tasks, 1):
    print(i, task)

Step 4: Remove a Task

Use pop() to remove a task using its position.

Python
task_number = int(
    input("Enter task number to remove: ")
)

tasks.pop(task_number - 1)

🚀 Complete Python Code

todo.py
tasks = []


def show_tasks():

    if len(tasks) == 0:

        print("No tasks available.")

    else:

        print("\nYour Tasks:")

        for i, task in enumerate(tasks, 1):

            print(i, ".", task)


while True:

    print("\n===== TO-DO LIST =====")

    print("1. Add Task")
    print("2. View Tasks")
    print("3. Remove Task")
    print("4. Exit")

    choice = input("Enter your choice: ")


    if choice == "1":

        task = input("Enter task: ")

        tasks.append(task)

        print("Task added successfully!")


    elif choice == "2":

        show_tasks()


    elif choice == "3":

        show_tasks()

        if len(tasks) > 0:

            task_number = int(
                input("Enter task number to remove: ")
            )

            if 1 <= task_number <= len(tasks):

                removed_task =
                    tasks.pop(task_number - 1)

                print(
                    "Removed:",
                    removed_task
                )

            else:

                print("Invalid task number.")


    elif choice == "4":

        print("Goodbye!")

        break


    else:

        print("Invalid choice.")

⚠️ Important Python Formatting

In the complete code above, the assignment of removed_task should stay on one line.

Correct Code
removed_task = tasks.pop(task_number - 1)

💻 Example Output

===== TO-DO LIST =====

1. Add Task
2. View Tasks
3. Remove Task
4. Exit

Enter your choice: 1

Enter task: Complete Python homework

Task added successfully!


===== TO-DO LIST =====

Enter your choice: 2

Your Tasks:
1 . Complete Python homework

🧠 Mini Challenge

Try improving the To-Do List by adding:

📝 Try the To-Do List

Add your tasks, mark them as completed, or delete them.

0 tasks
    No tasks yet. Add your first task!
    ← Previous Project Next Project →