Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a simple AI agent class.
Agentic_ai
class Agent: def __init__(self, name): self.name = [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
2fill in blank
mediumComplete the code to make the agent perform an action.
Agentic_ai
class Agent: def act(self, task): print(f"Agent [1] is performing: {task}")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
3fill in blank
hardFix the error in the agent's decision method to return the correct action.
Agentic_ai
class Agent: def decide(self, options): best_option = max(options, key=lambda x: x['score']) return best_option[1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
4fill in blank
hardFill both blanks to create a dictionary comprehension that maps tasks to their priorities if priority is above 5.
Agentic_ai
tasks = ['clean', 'cook', 'shop'] priorities = {'clean': 7, 'cook': 4, 'shop': 9} high_priority = {task: priorities[task] for task in tasks if priorities[task] [1] [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
5fill in blank
hardFill all three blanks to create a dictionary of task names in uppercase mapped to their priority if priority is less than 8.
Agentic_ai
tasks = ['read', 'write', 'code'] priorities = {'read': 6, 'write': 8, 'code': 7} filtered_tasks = {task[1]: priorities[task] for task in tasks if priorities[task] [2] [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
