Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a list of agents.
Agentic AI
agents = [[1] for _ in range(5)]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'agent' instead of 'Agent()' creates a list of the same reference.
✗ Incorrect
The code creates 5 new Agent objects in a list using a list comprehension.
2fill in blank
mediumComplete the code to have each agent perform a task.
Agentic AI
for agent in agents: agent.[1]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' or 'start' which may not be defined methods.
✗ Incorrect
The method perform_task() is called on each agent to make it do its job.
3fill in blank
hardFix the error in the code to collect results from agents.
Agentic AI
results = [agent.[1] for agent in agents]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting parentheses causes a list of method references, not results.
✗ Incorrect
The method get_result() must be called with parentheses to get each agent's output.
4fill in blank
hardFill both blanks to combine agent results and check if all succeeded.
Agentic AI
combined = sum(results) all_success = all(result [1] [2] 0 for result in results)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' would only check for exact zero, not success range.
✗ Incorrect
We check if all results are greater than or equal to zero to confirm success.
5fill in blank
hardFill all three blanks to create a dictionary mapping agent IDs to their results if result is positive.
Agentic AI
agent_results = {agent.id: result for agent, result in zip(agents, results) if result [1] [2] 0 and agent.[3] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect attribute names or wrong comparison operators.
✗ Incorrect
The dictionary comprehension filters results greater than zero and only includes agents that are active.