Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
16 views6 pages

To Do List

The document outlines a To Do List application that allows users to add, delete, and display tasks. It includes functions for adding items, deleting specified tasks, and displaying the current list of tasks, along with error handling for various scenarios. The application operates through a menu-driven interface where users can choose actions until they decide to exit.

Uploaded by

lavanyan1205
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views6 pages

To Do List

The document outlines a To Do List application that allows users to add, delete, and display tasks. It includes functions for adding items, deleting specified tasks, and displaying the current list of tasks, along with error handling for various scenarios. The application operates through a menu-driven interface where users can choose actions until they decide to exit.

Uploaded by

lavanyan1205
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

To Do List Application

print("**************************** To Do List
*************************************")

d={}
def Add():
length=int(input("Enter no.of Items you want to add "))
for i in range(length):
item=input("Enter Item ")
d.update({len(d)+1:item})
print("Items Added Succefully ..........")

# deleting Items
def Delete():
# When List is Empty
if len(d)==0:
print("List is empty")
return

dlen=int(input('Enter no.of Items you want to delete '))


# when no of items are not present in list
if dlen>len(d):
print("No of Items Not Present ")
return

else:
while(dlen!=0):
dno=int(input("Enter Task Number "))
if dno not in d:
print('Task Not exist')

else:
d.pop(dno)
dlen-=1
print("---------------------------Deleted Succefully \U0001F600")

# Display Items
def Display():
print("-----------------------Your To Do List-------------------")
# when list is empty
if len(d)==0:
print("**************No Tasks To do \U0001F600")
for k,v in d.items():
print(str(k),"-",v,"✅")

# Menu Programe
def Menu(n):
if n==1:
Add()
elif n==2:
Delete()
elif n==3:
Display()

print("Please Enter your Choice: ")


print('1.Add Items')
print('2.Delete Items')
print('3.Display List')
print('4.Exist')
n=int(input('Enter Choice: '))
while(n!=4):
Menu(n)
print('if you want to continue enter choice if not press 4')
if (n!=4):
print('1.Add Items')
print('2.Delete Items')
print('3.Display List')
n=int(input("Enter Choice: "))
print("Thank you for Visiting \U0001F600")
To Do List Application
Output
Test 1: Menu

Test 2: Exist From Menu

Add Items
Test 1: Add Items
Display Items
Test 1: List is empty

Test 2: List having Items


Delete Items
Test 1: When no Items in list

Test 2: When no.of Items are not present in list

Test 3: When Tasks are not exist

Test 4: Deleted succefully

You might also like