Prompt Engineering
AI · Beginner
Definition
Prompt engineering is writing clear instructions and context so an LLM produces the desired output.
Better prompts give more accurate and consistent AI results.
Diagram
Flowchart
Example: Structured prompt
prompt = '''You are a DSA tutor.
Explain binary search in 3 bullet points.
Return markdown.'''
print(len(prompt.splitlines()))Output: 3
Key points
- Few-shot examples improve accuracy
- Ask for step-by-step reasoning on hard tasks
Interview questions
Zero-shot vs few-shot?
Zero-shot gives no examples; few-shot includes a few input-output examples.