0% found this document useful (0 votes)
4 views2 pages

Todo New

This document outlines a simple to-do list management program that allows users to add, remove, view, and search for tasks. The program operates in a loop, presenting a menu with options for user interaction. It handles invalid inputs and provides feedback based on user actions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Todo New

This document outlines a simple to-do list management program that allows users to add, remove, view, and search for tasks. The program operates in a loop, presenting a menu with options for user interaction. It handles invalid inputs and provides feedback based on user actions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

todo_list=[]

while True:

print("\nto-do list menu:")

print("1.add task")

print("2.remove task")

print("3.view all task")

print("4.search task")

print("5.exit")

choice = input ("enter your choice(1-5):")

if choice =='1':

task=input("enter the task to add:")

todo_list.append(task)

print("task added:",task)

elif choice =='2':

task = input ("enter the task to remove:")

if task in todo_list:

todo_list.remove(task)

print("task removed:",task)

else:

print("task not found.")

elif choice =='3':

if len (todo_list)== 0:

print("to-do list is empty.")

else:

print("\nyour to-do list:")

index =1
for task in todo_list:

print(str(index)+".", task)

index +=1

elif choice == '4':

keyword = input ('enter keyword to search:')

found =False

for task in todo_list:

if keyword.lower()in task.lower():

print ("found task:",task)

found =True

if not found:

print ("no matching task found.")

elif choice =='5':

print("exit to-do list manager.")

break

else:

print("invalid choice.please enter a number between 1 and 5.")

You might also like