AI Computer Science Academy · Faisalabad

AI & Prompt Engineering

Version your prompts

Task 39 of 56 Python Content and quality
All tasks
Read first Task 39

Version your prompts

A prompt is code. Give it a name and a version, so when an answer improves or breaks you can say exactly what changed and go back.

Task

Why version a prompt?

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
PROMPTS = {
    'fee_v1': 'Answer the fee question in one sentence.',
    'fee_v2': 'Answer the fee question in one sentence. Always say the fee is per month. Never mention an installation fee.'
}

def prompt(name):
    return PROMPTS[name]

print('v1 words:', len(prompt('fee_v1').split()))
print('v2 words:', len(prompt('fee_v2').split()))
print('v2 keeps the per-month rule:', 'per month' in prompt('fee_v2'))
Python 1 automatic check Content and quality
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)