Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to add a new instruction to the prompt list.
Prompt Engineering / GenAI
prompt_steps = ['Describe the image'] prompt_steps.append([1])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a step unrelated to refining the prompt.
Using a step that changes the task instead of refining.
✗ Incorrect
Appending 'Add more details' adds a refinement step to the prompt.
2fill in blank
mediumComplete the code to update the prompt with the latest refinement.
Prompt Engineering / GenAI
current_prompt = 'Describe the image' refinement = 'Add color details' updated_prompt = current_prompt + [1] + refinement
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a separator that is too informal or unclear.
Not using any separator causing prompt parts to merge.
✗ Incorrect
Using '; ' separates prompt parts clearly for iterative refinement.
3fill in blank
hardFix the error in the code that applies a refinement function to the prompt.
Prompt Engineering / GenAI
def refine_prompt(prompt): return prompt.lower() prompt = 'Describe the Image' refined = [1](prompt)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect function name casing.
Not calling the function properly.
✗ Incorrect
The function name is 'refine_prompt' and should be called with parentheses when passing the prompt argument.
4fill in blank
hardFill both blanks to create a loop that applies multiple refinements to a prompt.
Prompt Engineering / GenAI
prompt = 'Describe the scene' refinements = ['Add lighting', 'Include objects'] for [1] in [2]: prompt += '; ' + [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same name for loop variable and list.
Using undefined variable names.
✗ Incorrect
Loop variable 'refinement' iterates over list 'refinements' to update prompt.
5fill in blank
hardFill all three blanks to build a dictionary of prompt versions with their lengths.
Prompt Engineering / GenAI
prompts = ['Describe the sky', 'Add stars', 'Include moon'] prompt_lengths = { [1]: len([2]) for [3] in prompts }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names causing errors.
Using undefined variables in the comprehension.
✗ Incorrect
Using 'p' as the variable name consistently builds the dictionary correctly.