Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a prompt template with a variable placeholder.
Prompt Engineering / GenAI
prompt = "Hello, [1]! Welcome to AI."
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using plain text without curly braces.
Using a variable name that doesn't match the context.
✗ Incorrect
The placeholder {user} is commonly used to represent the variable part in prompt templates.
2fill in blank
mediumComplete the code to insert a variable into the prompt template using f-string syntax.
Prompt Engineering / GenAI
name = "Alice" prompt = f"Hello, [1]! How are you?"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using placeholders like {user} instead of the actual variable name.
Not using f-string syntax.
✗ Incorrect
In f-strings, variables are inserted directly without curly braces inside the string, so {name} is correct.
3fill in blank
hardFix the error in the prompt template by correctly formatting the variable placeholder.
Prompt Engineering / GenAI
prompt = "Your input is: [1]".format(input)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using named placeholders without passing named arguments.
Using empty braces {} without arguments.
✗ Incorrect
Using {0} matches the first argument passed to format(), which is 'input'.
4fill in blank
hardFill both blanks to create a prompt template that uses named variables with format().
Prompt Engineering / GenAI
prompt = "Hello, [1]! Your score is [2].".format([1]="Alice", [2]=95)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatch between placeholder names and format argument names.
Using positional placeholders with named arguments.
✗ Incorrect
The placeholders and format arguments must use the same variable names; here 'user' and 'score' are used.
5fill in blank
hardFill all three blanks to build a prompt template using f-string with multiple variables.
Prompt Engineering / GenAI
user = "Bob" score = 88 prompt = f"Hello, [1]! Your score is [2] out of [3]."
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using undefined variable names.
Putting variables inside quotes inside f-string.
✗ Incorrect
The f-string inserts variables directly: user, score, and a fixed total of 100.