Untitled
todo_list = [] def display_menu(): print("\t YOUR TO DO\n\n1.View List\t\t2.New To Do\n\n3.Completed To Do\t4.Exit") def view_tasks(): if not todo_list: print("\nNo To Do!") else: print("Your To Do:") for i, task in enumerate(todo_list, 1): print(f"{i}. {task}") def add_task(): task = input("Enter The New To Do: ") todo_list.append(task) print("To Do added!") def delete_task(): if not todo_list: print("\nNo To Do Completed") else: view_tasks() try: task_number = int(input("Which To Do Completed: ")) if 1 <= task_number <= len(todo_list): removed_task = todo_list.pop(task_number - 1) print(f"Hurray '{removed_task}' Completed!") else: print("Invalid To Do.") except ValueError: print("Invalid Input. Please Enter A Number.") while True: display_menu() choice = input("What You Want?\n\n\t") if choice == '1': view_tasks() elif choice == '2': add_task() elif choice == '3': delete_task() elif choice == '4': print("Bye Bye") break else: print("Invalid choice. Please try again.")
Leave a Comment