Step 1: Set up your development environment
Ensure you have Python installed on your computer. You can download Python from the official website: https://www.python.org/downloads/. You'll also need a code editor or IDE, like Visual Studio Code, PyCharm, or Jupyter Notebook.
Step 2: Plan the structure of your To-Do List
Think about what features your To-Do List Manager should have. At a minimum, it should be able to:
- Add tasks
- View tasks
- Mark tasks as done
- Remove tasks
Step 3: Create a Python script
Start by creating a Python script (e.g., todo_manager.py
). You can use a class-based approach for better organization. Here's a simple example:
class ToDoList:
def __init__(self):
self.tasks = []
def add_task(self, task):
self.tasks.append(task)
def view_tasks(self):
for i, task in enumerate(self.tasks, start=1):
print(f"{i}. {task}")
def mark_task_as_done(self, task_number):
if 1 <= task_number <= len(self.tasks):
self.tasks[task_number - 1] += " (Done)"
else:
print("Invalid task number")
def remove_task(self, task_number):
if 1 <= task_number <= len(self.tasks):
del self.tasks[task_number - 1]
else:
print("Invalid task number")
def main():
todo_list = ToDoList()
while True:
print("\n===== To-Do List Manager =====")
print("1. Add Task")
print("2. View Tasks")
print("3. Mark Task as Done")
print("4. Remove Task")
print("5. Quit")
choice = input("Enter your choice: ")
if choice == "1":
task = input("Enter the task: ")
todo_list.add_task(task)
elif choice == "2":
todo_list.view_tasks()
elif choice == "3":
task_number = int(input("Enter the task number to mark as done: "))
todo_list.mark_task_as_done(task_number)
elif choice == "4":
task_number = int(input("Enter the task number to remove: "))
todo_list.remove_task(task_number)
elif choice == "5":
break
else:
print("Invalid choice. Please try again.")
if __name__ == "__main__":
main()
Step 4: Run the script
Execute your Python script using the command line or your code editor.
Top comments (0)