Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a simple agent that prints a greeting.
Agentic_ai
class SimpleAgent: def __init__(self, name): self.name = name def greet(self): print([1])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
2fill in blank
mediumComplete the code to make the agent decide an action based on input.
Agentic_ai
def decide_action(input_text): if 'hello' in input_text.lower(): return [1] else: return 'ignore'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
3fill in blank
hardFix the error in the agent's learning method to update knowledge correctly.
Agentic_ai
class LearningAgent: def __init__(self): self.knowledge = [] def learn(self, data): self.knowledge.[1](data)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
4fill in blank
hardFill both blanks to create a dictionary of agent names and their scores above 50.
Agentic_ai
scores = {'agent1': 45, 'agent2': 75, 'agent3': 60}
high_scores = { [1]: [2] for [1], [2] in scores.items() if [2] > 50 } Drag options to blanks, or click blank then click option'
Attempts:
3 left
5fill in blank
hardFill all three blanks to filter and transform agent data into a new dictionary.
Agentic_ai
agents = {'a1': 30, 'a2': 55, 'a3': 70}
filtered_agents = { [1]: [2]*2 for [1] in agents if agents[[3]] > 50 } Drag options to blanks, or click blank then click option'
Attempts:
3 left
