Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@
print("\nAll Tasks:")
display_tasks(tasks)

filter_tasks(tasks, "project")

# Creating a generator for "project" tasks
project_tasks = task_generator(tasks, "project")

# Retrieving tasks lazily
print(next(project_tasks)) # Output: 'Finish project'
13 changes: 7 additions & 6 deletions src/tasks/task_manager.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
def display_tasks(task_list):
"""Displays the list of tasks."""
print(f"\nDisplaying all tasks is not yet implemented")
print("\nCurrent To-Do List:")
for index, task in enumerate(task_list, start=1):
print(f"{index}. {task}")

def filter_tasks(task_list, keyword):
"""Placeholder for filtering tasks (students will implement)."""
print(f"\nFiltering for '{keyword}' is not yet implemented.")
filtered = [task for task in task_list if keyword.lower() in task.lower()]
print(f"\nTasks matching '{keyword}':")
display_tasks(filtered)

def task_generator(task_list, keyword):
"""Placeholder for generator-based filtering (students will implement)."""
print(f"\nLazy evaluation for '{keyword}' is not yet implemented.")
return (task for task in task_list if keyword.lower() in task.lower())