0
0
Agentic_aiml~10 mins

Token usage and cost tracking in Agentic Ai - Interactive Code Practice

Choose your learning style8 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize the token counter variable.

Agentic_ai
token_count = [1]
Drag options to blanks, or click blank then click option'
A0
BNone
C1
D''
Attempts:
3 left
2fill in blank
medium

Complete the code to add the number of tokens used in the current step to the total count.

Agentic_ai
token_count [1]= tokens_used
Drag options to blanks, or click blank then click option'
A+
B*
C-
D/
Attempts:
3 left
3fill in blank
hard

Fix the error in the code to calculate the cost based on tokens used and price per token.

Agentic_ai
cost = tokens_used [1] price_per_token
Drag options to blanks, or click blank then click option'
A+
B-
C/
D*
Attempts:
3 left
4fill in blank
hard

Fill both blanks to create a dictionary that tracks tokens and cost for each step.

Agentic_ai
usage = {'tokens': [1], 'cost': [2]
Drag options to blanks, or click blank then click option'
Atokens_used
Btotal_cost
Ccost
Dtoken_count
Attempts:
3 left
5fill in blank
hard

Fill all three blanks to update total tokens, calculate cost, and store usage info.

Agentic_ai
token_count [1]= tokens_used
cost = tokens_used [2] price_per_token
usage = {'tokens': tokens_used, 'cost': [3]
Drag options to blanks, or click blank then click option'
A+
B*
Ccost
D-
Attempts:
3 left