Bird
Raised Fist0
Agentic AIml~10 mins

Cost optimization strategies 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 calculate the total cost by multiplying unit cost and quantity.

Agentic AI
total_cost = unit_cost [1] quantity
Drag options to blanks, or click blank then click option'
A*
B+
C-
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using addition instead of multiplication
Using division or subtraction by mistake
2fill in blank
medium

Complete the code to calculate the average cost from a list of costs.

Agentic AI
average_cost = sum(costs) [1] len(costs)
Drag options to blanks, or click blank then click option'
A*
B+
C/
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication or addition instead of division
3fill in blank
hard

Fix the error in the code to select the minimum cost from a list.

Agentic AI
min_cost = [1](costs)
Drag options to blanks, or click blank then click option'
Amax
Bmin
Csum
Dlen
Attempts:
3 left
💡 Hint
Common Mistakes
Using max instead of min
Using sum or len which do not find minimum
4fill in blank
hard

Fill both blanks to create a dictionary of costs for items with cost greater than 50.

Agentic AI
high_cost_items = {item: [1] for item, [2] in costs.items() if [1] > 50}
Drag options to blanks, or click blank then click option'
Acost
Bitem
Ccosts
Dvalue
Attempts:
3 left
💡 Hint
Common Mistakes
Using item instead of cost for values
Using costs instead of cost in loop
5fill in blank
hard

Fill all three blanks to filter and create a dictionary of items with cost less than 100.

Agentic AI
filtered_costs = { [1]: [2] for [3], cost in costs.items() if cost < 100 }
Drag options to blanks, or click blank then click option'
Aitem
Bcost
Dvalue
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up keys and values
Using wrong variable names in loop