DEV Community

Jessica milano
Jessica milano

Posted on

Getting Started with Python: Build Your First Command-Line To-Do App

If you've ever wanted to learn programming but felt overwhelmed by all the buzzwords, Python is one of the friendliest languages to start with. It reads almost like plain English, and you can build something useful in your very first sitting. In this guide, we'll walk through setting up Python and building a simple command-line to-do list — a classic first project that teaches you the core building blocks of any real application.

Why Python?

Python has become one of the most popular languages in the world, and for good reason:

Readable syntax — Python code looks close to natural language, so beginners can focus on logic instead of getting lost in symbols and semicolons.

Huge community — Whatever problem you run into, chances are someone has already asked (and answered) it online.

Versatile — The same language you use to build a to-do app today can power web servers, data analysis pipelines, or automation scripts tomorrow.

Batteries included — Python ships with a rich standard library, so you can do a lot without installing anything extra.

Setting Up Your Environment

Before writing any code, let's get Python installed.

Step 1: Install Python

Head over to python.org and download the latest version for your operating system. During installation on Windows, make sure to check the box that says "Add Python to PATH" — it'll save you a headache later.

Step 2: Verify the Installation

Open your terminal (or Command Prompt) and run:

python --version
Enter fullscreen mode Exit fullscreen mode

If you see a version number printed back, you're ready to go.

Step 3: Create a Project Folder

mkdir todo-app
cd todo-app
Enter fullscreen mode Exit fullscreen mode

Step 4: Create Your Script File

Inside that folder, create a file called todo.py. This is where all our code will live.

Building the To-Do App

We're going to build a simple app that lets you:

  • Add tasks
  • View your task list
  • Mark tasks as complete
  • Exit the program

Step 1: Set Up the Task List

At the top of todo.py, add:

tasks = []

def show_menu():
    print("\n--- To-Do List ---")
    print("1. Add a task")
    print("2. View tasks")
    print("3. Mark a task as done")
    print("4. Exit")
Enter fullscreen mode Exit fullscreen mode

Step 2: Add the Core Functions

def add_task():
    task = input("Enter a new task: ")
    tasks.append({"task": task, "done": False})
    print(f"Added: {task}")

def view_tasks():
    if not tasks:
        print("Your list is empty.")
        return
    for i, t in enumerate(tasks, start=1):
        status = "" if t["done"] else " "
        print(f"[{status}] {i}. {t['task']}")

def complete_task():
    view_tasks()
    if not tasks:
        return
    choice = int(input("Which task number is done? "))
    if 1 <= choice <= len(tasks):
        tasks[choice - 1]["done"] = True
        print("Nice work — task marked complete!")
    else:
        print("That task number doesn't exist.")
Enter fullscreen mode Exit fullscreen mode

Step 3: Tie It All Together

def main():
    while True:
        show_menu()
        choice = input("Choose an option (1-4): ")

        if choice == "1":
            add_task()
        elif choice == "2":
            view_tasks()
        elif choice == "3":
            complete_task()
        elif choice == "4":
            print("Goodbye!")
            break
        else:
            print("Please choose a valid option.")

if __name__ == "__main__":
    main()
Enter fullscreen mode Exit fullscreen mode

Step 4: Run It

Back in your terminal:

python todo.py
Enter fullscreen mode Exit fullscreen mode

You now have a working to-do list you can add to, check off, and manage entirely from the command line.

What You Just Learned

In building this small app, you actually practiced several core programming concepts:

  • Lists and dictionaries — storing structured data
  • Functions — organizing code into reusable pieces
  • Loops and conditionals — controlling the flow of a program
  • User input — making a program interactive

Where to Go From Here

This to-do app is intentionally simple, but it's a great foundation. From here, you could try:

  • Saving tasks to a file so they persist after you close the program
  • Adding due dates or priority levels
  • Turning it into a small web app using Flask

Programming rewards curiosity more than talent — the more small projects you build, the more natural it all becomes.

Every workspace could use a little personality once you're done coding for the day — much like a well-placed neon sign adds character to a room, a clean, well-organized script adds a bit of craftsmanship to your code.

Happy coding!

Top comments (0)