Artificial Intelligence · Grade 7 · Chapter 9
Prompt Engineering Basics
How to communicate effectively, precisely, and ethically with Large Language Models.
Chapter Goals
What We Will Master Today
- Understanding LLMs: Learn how Large Language Models generate text.
- The R-C-I-O Framework: Structure master prompts with Role, Context, Instruction, Output.
- Few-Shot Prompting: Guide AI responses by providing concrete examples.
- Detecting Hallucinations: Critically evaluate AI outputs for inaccuracies.
The Art of Prompting
Bad Prompts vs Master Prompts
Student A types: "Explain Python." → Gets a 1,000-word boring textbook answer.
Student B types a 4-part structured prompt → Gets a 3-minute fun, tailored study guide!
Concept: Prompt Engineering is the skill of designing clear instructions so AI gives you exactly what you need.
Core Concept 1
How Large Language Models Work
An LLM (like ChatGPT or Gemini) is a high-speed statistical word predictor trained on billions of sentences.
It does NOT "think" or feel. It calculates: "Given the user's prompt, what is the most likely and useful next word to write?"
Core Concept 2
The R-C-I-O Prompting Framework
Role
Persona
Who should AI pretend to be?
"Act as a patient CS teacher."
Context
Background
What is the situation?
"I am a Grade 7 student learning loops."
Instruction
Action
What exact task to perform?
"Explain `for` vs `while` loops."
Output
Format
How should it look?
"Use a bulleted 2-column table."
Prompt Comparison
Weak Prompt vs R-C-I-O Master Prompt
✗ Vague Prompt
"Help me study Python loops."
Result: Overwhelming, generic text walls.
✓ R-C-I-O Master Prompt
"Act as a Grade 7 computer tutor. I am studying for a Python quiz on `for` loops. Write a 3-question practice quiz with click-to-reveal answers."
Core Concept 3
Zero-Shot vs Few-Shot Prompting
Providing example input/output pairs inside your prompt is called Few-Shot Prompting.
Zero-Shot (No Examples)
Asking AI to perform a task directly without showing any sample outputs.
Few-Shot (2+ Examples)
Showing 2 example pairs first so AI mimics the exact formatting style you want.
Few-Shot Template
Few-Shot Prompting Example
Convert English rules into Python code:
Example 1:
Input: "Check if age is 13 or older"
Output: if age >= 13:
Example 2:
Input: "Check if score is equal to 100"
Output: if score == 100:
Now do this:
Input: "Check if health is less than 10 or player is poisoned"
Core Concept 4
What is an AI Hallucination?
An AI Hallucination is when an LLM confidently presents completely false or fabricated information as fact!
Why it happens: LLMs predict plausible-sounding words, but they do NOT have a real-time truth meter.
Verification Protocol
3 Steps to Fact-Check AI Output
1
Check Primary Sources (Textbook / Official Docs)
2
Verify Code by Running It in an IDE
3
Ask AI to cite specific sources or explain step-by-step
Smartboard Voting
Which Prompt Will Generate the Best Study Guide?
A) "Tell me about Python data types."
B) "Act as a CS teacher. Create a 1-page summary table of Python str, int, float, and bool with 2 code examples for each."
Ethical Discussion
Using AI for Homework: Help vs Cheating
✓ Ethical Learning Partner
Using AI to explain tricky error messages, generate practice quiz items, or brainstorm project ideas.
✗ Academic Dishonesty
Copy-pasting an AI response directly into your homework submission without understanding or editing it.
Core Concept 5
Iterative Prompting (Refining Results)
Rarely does the first prompt give perfect output. Treat prompting as a continuous conversation!
3
Add Constraints (e.g. "Shorter", "Easier words")
Refinement Sandbox
Refining an AI Response in 3 Turns
Turn 1: "Explain variables in Python."
[AI output is too long and complex]
Turn 2: "Simplify that explanation for a 7th grader using a memory box analogy."
[AI output improves!]
Turn 3: "Great! Now add 3 practice questions with answers."
Data Safety
Never Put PII into AI Prompts!
Prompts entered into public AI tools may be saved to train future models.
- NEVER share: Full names, passwords, home addresses, phone numbers.
- NEVER upload: Personal photos or private family documents.
Quick Check · Quiz 1
What does the "R" in the R-C-I-O framework stand for?
ARules
BRole (Persona)
CRepeat
DRandom
Click to reveal answer
Quick Check · Quiz 2
What is an AI Hallucination?
AWhen AI generates a 3D image
BWhen AI confidently outputs false or invented facts
CWhen the AI server goes offline
DWhen Python throws a SyntaxError
Click to reveal answer
Quick Check · Quiz 3
What distinguishes Few-Shot Prompting from Zero-Shot Prompting?
AFew-shot uses fewer words
BFew-shot provides example input/output pairs in the prompt
CZero-shot is only for math
DFew-shot requires Python code
Click to reveal answer
Quick Check · Quiz 4
Which of the following should NEVER be typed into a public AI prompt?
AQuestions about Python syntax
BRequests for history summaries
CYour passwords, home address, or personal ID numbers
DASCII art requests
Click to reveal answer
Guided Practice
Transform a Weak Prompt into a Master Prompt
Weak Prompt: "Help me with my history project on ancient Egypt."
Apply R-C-I-O:
Role: Expert History Tutor
Context: Grade 7 project on Pyramids
Instruction: Provide 5 key engineering facts
Output: Bulleted list with bold key terms!
Coding Helper
Prompt Template for Fixing Python Errors
"Act as a Python debugging assistant. I am getting this error message: [PASTE ERROR]. Here is my code: [PASTE CODE]. Explain what went wrong in 2 simple sentences and show the corrected code."
Myth Buster
Prompting Myths
Myth
"Politeness ('please', 'thank you') makes AI smart."
Fact
Structure, role clarity, context, and explicit constraints drive response quality!
Summary & Takeaways
What We Learned in Chapter 9
- LLMs generate statistical word predictions based on your prompt instructions.
- Use the R-C-I-O framework (Role, Context, Instruction, Output) for master prompts.
- Few-Shot prompting guides formatting through concrete examples.
- Always verify AI outputs to spot hallucinations and protect your data privacy.
Exit Ticket
Master Prompt Challenge
Write an R-C-I-O Prompt to ask AI to help you create a study guide for Python data types.
Next Chapter: AI Tools & Productivity!