How to create a Task manager in Python | Step-by-Step Guide #coding #python #programming

Build a command-line task manager in Python using lists and functions. The tutorial walks through adding, viewing, updating, and deleting tasks with a menu loop, then demonstrates it by adding running, studying, and eating, updating eating to sleeping, and deleting the second task.
Chapters
Let's create a task manager using Python programming language. So I am going to initialize an empty list task, then I am creating a function to add a task. This function will make us add the task. So I am taking input and enter the task title and the task description, then appending both the things into the list that we have created. Then I am printing task added successfully. Another feature that will be in the task manager is to view all the tasks that is available. Then I'm creating it. If task is there, then I am printing it using enumerate function. If you have not watched that video, you can go and watch it out. Then I am printing title, description, both the things, and using the print statement. If there is no task, then printing no task available. Another is the update. This is going to be the feature in our desk— task manager. Then updating it. So first I am taking an input whether which task you wanted to update, then index value will be there. Then I am checking for that index value into a list. If that is greater than 0, then okay. Otherwise it will continue with the next thing. But now I am asking it if it is present, then I am giving it an option to add a new title and new description. If new title is there, then I am going to change the new title. It means changing the value inside the list that we have created and then changing the description same way that we did in the task. Then I am printing task updated successful. Else what it will say? It will say invalid task index. And if task is not available, it will say no task available. Then the next feature is going to be the delete one. So we can delete the task as well. So first we are viewing the task, then if the task is available, then I am taking the input of the index value that user wanted to delete. If that value is there, and I am checking it using the if condition, then if that is there, then I am using the pop method of list to delete it. If that task is deleted, it will print which task has been deleted. And else it will say invalid task index and it will come out. And if task is not available, it will say no task available. Then writing a main loop using the condition true while loop I am using, and I am giving the basic instruction that interactive task manager, add task, view task, update task, delete task, and exit. So then I am taking the user's choice. As per the user's choice, I will be calling each and every function.
So if choice is equal to 1, then calling add task. Then if choice is 2, then view task. Then choice is 3, then I'm using update task. If choice is 4, then I'm deleting it. And if choice is 5, then I am going to call the— like nothing, calling nothing, just exiting the task manager and breaking out of the loop. And else it will say invalid choice, please select a valid option. I'm not breaking out the entire loop, I'm just breaking out the if. Now let's test the file. Here we got our instructions. Suppose I wanted to add it, I am going to add running, then adding a description that run— running for like, let's suppose, 30 minutes. So this is just a basic description. Then task added successfully. Let's add one more task and then we'll view it. So I'm adding one more task, suppose studies, and suppose I wanted to study the science concept today. So science concept, and then it's saying Task added successfully. Now adding eating, then favorite food. So let's view it. I have added 3 tasks. So when I am viewing it, it says that these are the tasks available in your task manager. Then I wanted to, let's suppose, update it. So which one I wanted to update? It's asking me for the index value. Let's suppose I wanted to update the third one, eating one. So it's asking me for the new title that I wanted to add. So instead of eating, let's suppose I wanted to add sleeping. So for sleeping, now I'm going to add description, let's suppose, for 8 hours. Then the task has been updated successfully. Now here we have updated task. I'm just viewing it using to. Then I am trying to delete it. So now let's suppose I wanted to delete the second one, which is study. Now it says that task study deleted successfully. Let's view it. Yes. It is deleted now. Now let's exit out of the Task Manager using 5. It says goodbye, exiting the Task










