🎯 Lesson Objectives
By the end of this lesson, you will:
- Generate your first piece of AI-written code
- Learn to READ code without fully understanding it
- Identify basic code elements (variables, functions, print statements)
- Practice asking AI to explain code to you
📖 Introduction: Reading Before Running
Here's an important principle for vibe coding:
The Reading Principle
You need to READ code before you can effectively WORK with code.
You don't need to memorize syntax or write code from scratch. But you DO need to:
- Recognize what different parts do
- Spot potential problems
- Understand the flow of logic
Think of it like being a music producer — you don't need to play every instrument, but you need to hear when something sounds wrong.
🎮 The Workshop Task
We're going to create a simple program:
Goal: A Python script that asks for your birth year and tells you your age.
Why Python?
- Clean, readable syntax
- Perfect for learning to READ code
- One of the most common languages
Why This Task?
- Simple enough to understand
- Complex enough to show real coding concepts
- Has clear input → process → output
📝 Step 1: Write Your Own Prompt First
Before looking at examples, try writing your own prompt for this task.
The task: Ask AI to create a Python script that:
- Asks the user for their birth year
- Calculates their age
- Displays a friendly message with their age
Reflection Journal
Take a minute to write this before moving on!
📝 Step 2: Compare With Example Prompt
Here's a well-crafted prompt using C.I.C. + Role:
Compare with your prompt:
- Did you specify Python?
- Did you ask for a friendly message?
- Did you request comments/explanations?
🤖 Step 3: The Generated Code
Send the prompt and you should receive something like this:
# Age Calculator Program # Get the current yearcurrent_year = 2024 # Ask the user for their birth yearbirth_year_text = input("What year were you born? ") # Convert the text input to a numberbirth_year = int(birth_year_text) # Calculate the ageage = current_year - birth_year # Display a friendly messageprint(f"Awesome! You are {age} years old this year! 🎂")Note: Your AI's output might look slightly different — that's fine!
🔍 Step 4: Code Reading Scavenger Hunt
Now let's learn to READ this code. Look at the generated code and answer these questions:
Question 1: Find the Variables 🔎
Variables are like labeled boxes that store information. They're created using the = sign.
How many variables can you spot?
Question 2: Find the Math ➕➖
Look for the calculation that determines the age.
What symbol is used for subtraction?
Question 3: Find the Output 📤
The print() function displays text to the user.
What message will the user see?
Question 4: Find the Input 📥
The input() function asks the user to type something.
What question does the program ask?
Question 5: Find the Conversion 🔄
Notice there are TWO variables for birth year. Why?
📊 Code Reading Quick Reference
Here's what to look for when reading code:
| Pattern | What It Usually Means |
|---|---|
something = value | Creating/storing data (variable) |
function() | Doing some action |
# text | A comment (ignored by computer, helps humans) |
"text" or 'text' | A piece of text (string) |
+, -, *, / | Math operations |
print() | Display something to user |
input() | Ask user to type something |
if, else | Making decisions |
for, while | Repeating something |
🎓 Step 5: Ask AI to Explain
Now practice getting explanations from AI. Try these follow-up prompts:
Prompt for Line-by-Line Explanation:
Prompt for Specific Part:
Prompt for Concepts:
🧪 Step 6: Modify Through Prompts
Now practice modifying code through conversation with AI.
Modification 1: Change the Message
Modification 2: Add More Info
Modification 3: Add Validation
Try each of these. See how AI modifies the code based on your requests!
🔑 Key Code Vocabulary
After this lesson, you should recognize:
| Term | What It Is | Example |
|---|---|---|
| Variable | Named storage for data | age = 25 |
| String | Text data | "Hello World" |
| Integer | Whole number | 2024 |
| Function | Action that does something | print(), input() |
| Comment | Note for humans | # This is a comment |
| Assignment | Storing value in variable | x = 5 |
✅ Completion Checklist
✅ Before moving on, verify:
0/6✅ Lesson Summary
What You Accomplished
- ✅ Wrote your first prompt for code generation
- ✅ Got AI to create a working Python script
- ✅ Analyzed the code to understand its parts
- ✅ Practiced asking AI for explanations
- ✅ Modified code through follow-up prompts
Key Insight
You don't need to memorize syntax. You need to recognize patterns and communicate clearly with AI.
📝 Mini Quiz
📝 Check Your Understanding
1/3What does a variable do in programming?