Computer Project 2024-25
Computer Project 2024-25
SESSION: 2024-25
UNDER
Udayan Debnath
GNPS, Sambalpur
Roll No:
Python Project: To-Do List Organizer
Code:
# Todo List Organizer in Python
# This program allows users to add, view, and remove tasks from a to-do list.
if choice == '1':
view_tasks()
elif choice == '2':
add_task()
elif choice == '3':
remove_task()
elif choice == '4':
print("Exiting Todo List Organizer. Goodbye!")
break
else:
print("Invalid choice. Please try again.")
1. Introduction:
2. Code Explanation:
- The program starts by defining an empty list called `todo_list`, where tasks
are stored.
- A menu is displayed using the `display_menu()` function to allow the user to
choose actions.
- The user can view the tasks with the `view_tasks()` function, which lists the
tasks or informs the user if the list is empty.
- The `add_task()` function prompts the user to input a new task, which is
then appended to the `todo_list`.
- To remove a task, the `remove_task()` function takes a task number as input,
checks its validity, and removes the corresponding task from the list.
- The program runs in an infinite loop, allowing continuous user interaction
until the user chooses to exit by selecting option `4`.
3. Functions: