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.")