Challenge - 5 Problems
Token Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding token counting in text inputs
If a text input contains the sentence:
"Hello world! How are you today?"
How many tokens would a typical tokenizer count for this sentence?
"Hello world! How are you today?"
How many tokens would a typical tokenizer count for this sentence?
Attempts:
2 left
💡 Hint
Think about how punctuation and spaces are usually split into tokens.
✗ Incorrect
Most tokenizers split words and punctuation separately. Here, 'Hello', 'world', '!', 'How', 'are', 'you', 'today', '?' are 8 tokens.
❓ Predict Output
intermediate2:00remaining
Calculate token cost for a prompt
Given a prompt with 150 tokens and a model charging $0.002 per 1,000 tokens, what is the cost for processing this prompt?
Attempts:
2 left
💡 Hint
Calculate cost by multiplying tokens by price per token.
✗ Incorrect
Cost = (150 tokens / 1000) * $0.002 = 0.15 * 0.002 = $0.0003
❓ Model Choice
advanced2:00remaining
Choosing a model based on token limits
You have a text input of 12,000 tokens. Which model should you choose if Model A supports up to 8,000 tokens and Model B supports up to 16,000 tokens?
Attempts:
2 left
💡 Hint
Check the maximum token limit for each model.
✗ Incorrect
Model A supports only 8,000 tokens, which is less than 12,000 tokens input. Model B supports 16,000 tokens, which is enough for 12,000 tokens input.
❓ Metrics
advanced2:00remaining
Estimating total cost for multiple API calls
You make 3 API calls with token usage: 500, 1,200, and 2,300 tokens. The cost is $0.0015 per 1,000 tokens. What is the total cost?
Attempts:
2 left
💡 Hint
Sum tokens first, then multiply by cost per token.
✗ Incorrect
Total tokens = 500 + 1200 + 2300 = 4000 tokens. Cost = (4000 / 1000) * 0.0015 = 4 * 0.0015 = $0.006
🔧 Debug
expert2:00remaining
Identify the error in token cost calculation code
What error does this code produce?
tokens = 1200
price_per_1000 = 0.002
cost = tokens * price_per_1000
print(f"Cost: ${cost}")Prompt Engineering / GenAI
tokens = 1200 price_per_1000 = 0.002 cost = tokens * price_per_1000 print(f"Cost: ${cost}")
Attempts:
2 left
💡 Hint
Check the order of operations and units in the formula.
✗ Incorrect
The code incorrectly omits the division by 1000. It calculates cost = tokens * price_per_1000 = 1200 * 0.002 = 2.4, printing Cost: $2.4, which is too high (correct would be $0.0024).