Creating Fill-in-the-Blank Patterns
Using {{variable}} placeholders and string substitution in Python.
The Placeholder Convention
A fill-in-the-blank prompt pattern uses placeholders to mark the parts of a prompt that will be substituted with real values before being sent to the model.
The most common placeholder convention is double curly braces: {{variable_name}}. This convention is easy to read, unlikely to appear in normal text accidentally, and widely supported by templating libraries.
Other conventions you will encounter: single curly braces {variable}, angle brackets <variable>, and ALL_CAPS variables. Choose one and be consistent.
Basic Placeholder Substitution
The simplest fill-in-the-blank pattern is direct string substitution:
Template: "Write a {{word_count}}-word description of {{product}} for {{audience}}."
Filled: "Write a 150-word description of TaskFlow Pro for small business owners."
The substitution happens before the string is sent to the model — the model sees a clean, complete prompt with no placeholder markers. Placeholders are a pre-processing step, not something the model itself handles.
All lessons in this course
- What Is a Prompt Template?
- Creating Fill-in-the-Blank Patterns
- Variable Substitution Techniques
- Reusing Templates Across Tasks