To-do list

 def todo_list():

    tasks = []
    while True:
        print("\n1. Add Task\n2. View Tasks\n3. Quit")
        choice = input("Enter your choice: ")
        if choice == "1":
            task = input("Enter the task: ")
            tasks.append(task)
        elif choice == "2":
            for idx, task in enumerate(tasks, 1):
                print(f"{idx}. {task}")
        elif choice == "3":
            break
        else:
            print("Invalid choice.")

todo_list()

Comments

Popular Posts