6 min read
🤖beginner

Prompt Engineering — Talking to AI Effectively

Learn how to write better prompts to get more useful and accurate responses from AI assistants like ChatGPT.

Why Your Prompts Matter

Have you ever asked an AI a question and gotten a confusing or unhelpful answer? The problem might not be the AI — it might be how you asked. Prompt engineering is the skill of writing clear, specific instructions that help AI give you exactly what you want. It is like the difference between telling someone 'make me food' vs. 'please make me a grilled cheese sandwich with tomato on sourdough bread.' The more specific you are, the better the result.

Tips for Better Prompts

1. Be Specific Bad: 'Tell me about space.' Good: 'Explain how black holes form, for a 12-year-old who loves science.' 2. Give Context Bad: 'Write some code.' Good: 'Write a Python function that takes a list of numbers and returns only the even ones.' 3. Set the Format Bad: 'What are healthy foods?' Good: 'List 5 healthy snacks for kids, with a one-sentence description of each.' 4. Ask for a Role Bad: 'Help me with math.' Good: 'Act as a patient math tutor and explain fractions step by step.'

Prompt Examples: From Weak to Strong

text
WEAK: Write a story.
STRONG: Write a short adventure story (about 200 words) for a 10-year-old, featuring a girl named Maya who discovers a secret coding lab inside her school. Make it exciting and end with a cliffhanger.

WEAK: Explain Python.
STRONG: Explain what Python is and why it is a great first programming language. Use simple analogies a beginner would understand, and give 3 examples of cool things you can build with Python.

WEAK: Fix my code.
STRONG: My Python code below should print even numbers from 1 to 20 but it prints nothing. Find the bug and explain what went wrong:
for i in range(1, 20):
    if i % 2 == 1:
        print(i)
Pro Tip

If you do not get a great answer on the first try, do not give up! Refine your prompt. You can say things like 'Make it simpler,' 'Give me a specific example,' or 'Explain it like I am 10 years old.' Prompt engineering is an iterative process — each attempt teaches you what works better.

Prompt Makeover

Take these weak prompts and rewrite them to be strong prompts: 1) 'Tell me about coding.' 2) 'Write a program.' 3) 'What is the internet?' For each one, add specifics: Who is the audience? What format do you want? How long should it be? What details matter? Then test your improved prompts on an AI and compare the results to the weak versions!

Ready to build?

Put what you learned into practice — pick a project and start coding.

Start Building Free