Weekend-1 # Project-2 CLI TO-DO-LIST WITH PYTHON

Table of contents

Building a TO-Do list was simpler compared to Resume checker. I used some of the colorful features that I learned while making Resume Keyword checker, to make the to-do list more engaging.
This project provided me a chance to flex my skills with logic , conditional operators and and loops.
OUTPUT:
WHAT I PRACTISED🎉
Loops
conditions
Colorama library for visual engagement
input handling
Lists
WHATS NEW 👀:
.append() -A python list method that adds a new item to the end of list
enumerate() -A python function that lets you loop through a list while also giving each item’s index and value.
Lists -A python data type that can store multiple items in a single variable, ordered and mutable
.remove() - A list method that deletes first matching value we specify
break -A python statement that stops a loop
EXPLANATION:
STEP 1: Taking user input and list initialization
To keep the program running till the user themselves want to exit, we use while loop. While loops allow users to choose the actions they want again and again unless they ask for ‘exit’.
after creating loop we add options inside it.
1- to add task
2- to view tasks
3- to delete any of the tasks
4- exit
To store’s the user inputs or here, to store the user’s tasks we create an empty list called tasks. I say, list is the most wonderful and solid part of this entire script.
STEP 2: The code logic:
ADDING A TASK ➕-( if user == 1)
If the user enter 1 and the task they want to add(input) We store it in the list ‘tasks’
to add the task to list we use .append()
.append() -a built-in list method that adds new elements(here, our tasks) to end of a list.
VIEWING TASKS 👀- (if user == 2)
If user enter 2- We display the tasks stored in list ‘tasks’
For printing the content of list in a clean and numbered order, we use enumerate()
enumerate()-It gives a numbered list .( If you are beginner, don’t feel overwhelmed, its just a normal loop but shows index)
DELETING A TASK ⚠️:( if user ==3)
If user enters 3 , they are asked to enter the index of the task they want to delete.
We simply , delete the index from the list
we can delete or remove an element(task) from list, using .remove().
EXIT 🏃♂️: (if user == 4)
- if user enters 4, then simply break the while loop using ‘break’.
EXTRA:
I have used colorama library to add colours. This one is optional so you can choose it or not. If you want to use, don’t forget to “from colorama import Fore, Style”. I have provided the GitHub link below. You can also modify the code more creatively and freely to your liking.
https://github.com/log-Null/python-CLI-collections/tree/main/CLI-TO-DO-LIST
Subscribe to my newsletter
Read articles from ..... directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

.....
.....
Aspiring Data Science Engineer | CSE Final Year student| Python GenAI Enthusiast | Building & Blogging my journey