Want to build something useful while learning Python?
In this tutorial, we’ll show you how to build a simple To-Do List app in Python, right in your terminal. This is a perfect beginner project to help you practice:
- Python lists
- Loops and conditions
- Functions
- User input
- Basic menu-driven interface
Let’s get started! 💻
🧾 What Will This App Do?
- Add new tasks
- View current tasks
- Delete a task
- Exit the program
All handled through a text-based menu.
🛠️ Step-by-Step Python Code
✅ Full Code (With Comments):
pythonCopyEdit# Simple To-Do List App (Console-Based)
# Initialize empty list to hold tasks
tasks = []
def show_menu():
print("\n--- To-Do List Menu ---")
print("1. View tasks")
print("2. Add task")
print("3. Delete task")
print("4. Exit")
def view_tasks():
if not tasks:
print("No tasks in the list.")
else:
print("\nYour Tasks:")
for i, task in enumerate(tasks, 1):
print(f"{i}. {task}")
def add_task():
task = input("Enter the new task: ")
tasks.append(task)
print(f"Task '{task}' added!")
def delete_task():
view_tasks()
try:
task_num = int(input("Enter task number to delete: "))
if 1 <= task_num <= len(tasks):
removed = tasks.pop(task_num - 1)
print(f"Task '{removed}' deleted!")
else:
print("Invalid task number.")
except ValueError:
print("Please enter a valid number.")
# Main loop
while True:
show_menu()
choice = input("Choose an option (1-4): ")
if choice == "1":
view_tasks()
elif choice == "2":
add_task()
elif choice == "3":
delete_task()
elif choice == "4":
print("Goodbye!")
break
else:
print("Invalid choice. Please try again.")
🔍 What You’ll Learn
- Lists: Store tasks in a list and manage them dynamically
- Functions: Break your program into reusable parts
- Loops: Keep the app running until the user exits
- Input/Output: Interact with the user in real-time
- Error handling: Use
try/exceptto prevent crashes
🛠️ Ideas to Take It Further
Once you’ve built the basic version, try adding:
- ✅ Save tasks to a file (so they persist between sessions)
- ✅ Mark tasks as complete
- ✅ Add a due date for each task
- ✅ Sort tasks by date or priority
- ✅ Build a GUI version using
tkinterorPyQt(advanced)
💡 Why This Project Is Great for Beginners
- You practice real programming logic
- You create a useful tool
- You can easily expand it into something bigger
- It prepares you for file handling, data structures, and UI development
🎯 Final Thoughts
Building a to-do list app in Python is more than a beginner exercise — it’s your first real-world productivity tool. It combines everything you’ve learned into one clean, functional script.
And best of all? You wrote it from scratch. 💪
🔜 Coming Up Next:
“How to Build a Password Generator in Python” 🔐
