From the course: Programming Foundations: Data Structures

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

GitHub Codespace solution: To-do list

GitHub Codespace solution: To-do list - Python Tutorial

From the course: Programming Foundations: Data Structures

GitHub Codespace solution: To-do list

(upbeat music) - [Instructor] Let's walk through building a simple to-do list application in Python using data structures. We'll begin by choosing a data structure to hold our tasks, and then we'll add functionality to manage them. For this application, we'll store tasks in a list. This will work well because it allows us to store the tasks in order and access them by index. The list of tasks will be shown whenever the homepage is hit. Now the post route should add a new task when it receives a task name in the request. We can represent each task is a dictionary. We'll have keys for ID, name, and completed. This will allow for clear labeling, making the code more readable and intuitive. It also allows for easy modification, so you can add more fields without changing the structure of existing tasks. Before creating this task, we'll set up a counter variable. This will keep track of the number of tasks that have been added so far, regardless of how many have been deleted. We'll use…

Contents