Building a To-Do List in Python | Step-by-Step Guide

Akansha Yadav builds a command-line to-do list in Python using a while loop and a list to store tasks. The app lets you add tasks or view them with enumerate to show each one numbered, and exits when you pick any option besides 1 or 2.
Chapters
Let's create a simple to-do list using Python programming language. So for this purpose, I will be using basic concepts like list, functions, and conditional statements. I am going to create an empty list over here, starting a while loop with the true condition, printing basic things. This is going to be a simple to-do list, so we can do two things only: add task or we can view the task. So printing both the things, then I am taking the choice of the user that what exactly user wants to do, wanted to add it or wanted to view it. After giving it a choice, I am checking if the choice is equal to 1, then I am going to give it another input— that I am going to take another input and asking it to add a new task. When I have the task, I will append it into the list that we have created above, then printing task added. Once this is done, if the user wants to view it, if the choice is equal to true, then if there is a task available, then I am saying print task. After that, I am going to use enumerate function so that I can print both the things— that what is the task index value and the task name. So for this purpose, I am using enumerate function. If you have not watched that video yet, then the link is in the description. You can just watch it out. If in case the task is not available, it will just say no task available and will continue. Else, I am going to say that break— it means come out of the loop. Let's run this and test it whether it gives us the same output or not. So I'm going to run the program. Here we got the output. We are getting the print statement instruction simple to do. Let's have a I want to add a task, so I'm entering 1, then adding a task, run, then task added. Simple. I'm going to test it whether it is there or not, then again adding it up and then printing it. If you like the video, don't forget to subscribe the










