AI Computer Science Academy · Faisalabad

AI & Prompt Engineering

Sizing a request

Task 12 of 56 Python Prompt engineering
All tasks
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.

Checks on this task:

  • Check 1

Track progress

0 of 56 tasks complete

Next task unlocks when every check passes.

Sign in to keep your code and certificates.

Next task (pass every check first)