Bird
Raised Fist0
Agentic AIml~10 mins

Computer use agents 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 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'
A"Hello, I am " + self.name
BHello, I am agent
Cself.name
Dprint('Hello')
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to use self.name inside the method.
Trying to print a string without concatenating the name.
2fill in blank
medium

Complete 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'
A'responding'
Brespond
C'respond'
D'response'
Attempts:
3 left
💡 Hint
Common Mistakes
Returning a variable name without quotes.
Returning a wrong string that does not match the expected action.
3fill in blank
hard

Fix 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'
Aappend
Badd
Cextend
Dinsert
Attempts:
3 left
💡 Hint
Common Mistakes
Using extend which expects an iterable and causes error if data is not iterable.
Using add which is not a list method.
4fill in blank
hard

Fill 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'
Aagent
Bscore
Cname
Dscore_value
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Not matching the variable names in the comprehension.
5fill in blank
hard

Fill 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'
Aagent_id
Bagents[agent_id]
Dagent
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Not multiplying the value correctly.