Bird
Raised Fist0
Agentic AIml~10 mins

Queue-based task processing in Agentic AI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add a task to the queue.

Agentic AI
task_queue.[1](new_task)
Drag options to blanks, or click blank then click option'
Aremove
Bpop
Cappend
Dclear
Attempts:
3 left
💡 Hint
Common Mistakes
Using pop instead of append removes an item instead of adding.
Using remove tries to delete a specific item, not add one.
2fill in blank
medium

Complete the code to get the next task from the queue.

Agentic AI
next_task = task_queue.[1](0)
Drag options to blanks, or click blank then click option'
Aappend
Bpop
Cinsert
Dclear
Attempts:
3 left
💡 Hint
Common Mistakes
Using append adds an item instead of removing.
Using insert adds an item at a position, not remove.
3fill in blank
hard

Fix the error in the code to check if the queue is empty.

Agentic AI
if len(task_queue) [1] 0:
    print('Queue is empty')
Drag options to blanks, or click blank then click option'
A>
B!=
C<
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' checks for non-empty instead of empty.
Using '>' or '<' does not correctly check for empty.
4fill in blank
hard

Fill both blanks to create a dictionary of task names and their priorities for tasks with priority higher than 5.

Agentic AI
high_priority_tasks = {task[1]: task.priority for task in tasks if task.priority [2] 5}
Drag options to blanks, or click blank then click option'
A.name
B>
C<
D_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' filters tasks with lower priority.
Using '_id' accesses the wrong attribute.
5fill in blank
hard

Fill all three blanks to create a dictionary of task IDs and their statuses for tasks that are completed.

Agentic AI
completed_tasks = {task[1]: task[2] for task in tasks if task.status [3] 'done'}
Drag options to blanks, or click blank then click option'
A.id
B.status
C==
D.name
Attempts:
3 left
💡 Hint
Common Mistakes
Using '.name' instead of '.id' for keys.
Using '!=' instead of '==' for filtering.