0
0
Prompt Engineering / GenAIml~10 mins

Prompt templates in Prompt Engineering / GenAI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Ausername
Buser_name
C{user_name}
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the curly braces around the variable name.
Using the variable name without braces.
Using incorrect variable names.
2fill in blank
medium

Complete 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'
A{topic}
Btopic
C<topic>
D[topic]
Attempts:
3 left
💡 Hint
Common Mistakes
Using brackets or angle brackets instead of curly braces.
Not using any braces around the variable name.
3fill in blank
hard

Fix 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'
A{question}
Bquestion
C"question"
D'question'
Attempts:
3 left
💡 Hint
Common Mistakes
Including extra curly braces.
Putting quotes around the variable name inside the braces.
4fill in blank
hard

Fill 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'
A{name}
Bname
C{color}
Dcolor
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names without braces.
Using braces without variable names.
Mixing braces and no braces.
5fill in blank
hard

Fill 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'
A{user_name}
B{user_age}
C{user_city}
Duser_info
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.