0
0
Agentic AIml~10 mins

Building custom tools 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 define a simple tool function that returns the square of a number.

Agentic AI
def square_number(num):
    return num [1] num
Drag options to blanks, or click blank then click option'
A+
B*
C-
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using + instead of * will add the number to itself, not square it.
Using - or / will cause incorrect results or errors.
2fill in blank
medium

Complete the code to create a tool that checks if a string contains the word 'AI'.

Agentic AI
def contains_ai(text):
    return [1] in text
Drag options to blanks, or click blank then click option'
A'ai'
B'aI'
C'AI'
D'Ai'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase 'ai' will not match uppercase 'AI' in the text.
Using mixed case strings will cause the check to fail.
3fill in blank
hard

Fix the error in the tool that returns the first element of a list.

Agentic AI
def first_element(items):
    return items[1]0
Drag options to blanks, or click blank then click option'
A(
B<
C{
D[
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses or curly braces causes syntax errors.
Using angle brackets is invalid syntax in Python.
4fill in blank
hard

Fill both blanks to create a tool that filters even numbers from a list.

Agentic AI
def filter_even(numbers):
    return [num for num in numbers if num [1] 2 [2] 0]
Drag options to blanks, or click blank then click option'
A%
B==
C!=
D//
Attempts:
3 left
💡 Hint
Common Mistakes
Using integer division // instead of modulus.
Using != instead of == will filter odd numbers instead.
5fill in blank
hard

Fill all three blanks to create a tool that builds a dictionary of word lengths for words longer than 3 characters.

Agentic AI
def word_lengths(words):
    return { [1]: [2] for word in words if len(word) [3] 3 }
Drag options to blanks, or click blank then click option'
Aword
Blen(word)
C>
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using <= instead of > will include shorter words.
Swapping key and value will create incorrect dictionary entries.