Read first
Task 12
Sizing a request
You pay per token, and one token is roughly four characters or three quarters of a word. Before you send a long prompt, estimate its size: a 13-word question is about 17 tokens.
Task
Which request costs more?
The editor already contains a starting point. Change it until every check passes — the Next task button unlocks when it does.
What you start with
def tokens(text):
return round(len(text.split()) * 1.3)
prompt = 'Explain the Python course fee and timing for a new student in Faisalabad.'
print(len(prompt), 'characters')
print(tokens(prompt), 'tokens (estimated)')
Python
1 automatic check Prompt engineering
Code editor
Ctrl + Enter runs
Run your code to see the output and the checks.
Your result
Submit your code to see results
Write your code in the middle column and press Run code.
Next task (pass every check first)
Hint
Ask yourself: Which request costs more?