Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a prompt template with a placeholder for a user's name.
Prompt Engineering / GenAI
prompt = f"Hello, [1]! How can I help you today?"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the curly braces around the variable name.
Using the variable name without braces.
Using incorrect variable names.
✗ Incorrect
The placeholder in an f-string must be enclosed in curly braces, so {user_name} is correct.
2fill in blank
mediumComplete the code to create a prompt template that asks for a topic and includes it in the prompt.
Prompt Engineering / GenAI
template = "Write a short paragraph about [1]."
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using brackets or angle brackets instead of curly braces.
Not using any braces around the variable name.
✗ Incorrect
The placeholder must be enclosed in curly braces to be replaced by the variable 'topic'.
3fill in blank
hardFix the error in the prompt template code to correctly insert the variable 'question'.
Prompt Engineering / GenAI
prompt = f"Please answer the following: [1]"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Including extra curly braces.
Putting quotes around the variable name inside the braces.
✗ Incorrect
In an f-string, the variable name should be inside single curly braces without quotes, so 'question' is correct.
4fill in blank
hardFill both blanks to create a prompt template that asks for a user's name and favorite color.
Prompt Engineering / GenAI
template = "Hello, [1]! Your favorite color is [2]."
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names without braces.
Using braces without variable names.
Mixing braces and no braces.
✗ Incorrect
Placeholders must be enclosed in curly braces, so {name} and {color} are correct.
5fill in blank
hardFill all three blanks to build a prompt template that asks for a user's name, age, and city.
Prompt Engineering / GenAI
template = "Name: [1], Age: [2], City: [3]."
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names without braces.
Using a single variable for all placeholders.
Forgetting braces on one or more placeholders.
✗ Incorrect
Each placeholder must be enclosed in curly braces with the correct variable name.