Lesson 1 of 8 · 28 min · Grades 6–8
Programs are recipes
Asha helps her grandmother make lemonade. The recipe is not a poem — it is a list of steps in a fixed order: wash lemons, squeeze, add sugar, add water, stir, taste. If Asha pours water before squeezing, the drink is watery and the sugar never dissolves properly. A Python program is the same kind of object: a sequence of instructions the computer obeys from top to bottom, without guessing what you “meant”.
Lemonade recipe
Steps in order — just like a program.
You will be able to
- ✓ Explain that a program is an ordered list of instructions
- ✓ Predict what happens if two lines are swapped
- ✓ Use # comments as notes for humans, not for the computer
What a program actually is
A computer is fast and obedient, and completely unimaginative. It will not skip a step because the step “looks obvious”. It will not add sugar because last time you added sugar. It only does what the text of the program says, in the order the lines appear.
That is why programmers talk about algorithms: a clear method that always finishes, like a recipe that always produces lemonade if you follow it. Python is one language for writing those methods so a machine can run them.
Kitchen → keyboard
Swap two steps in a recipe and the drink tastes wrong. Swap two lines in a program and the result changes — or the program crashes. Order is not decoration; it is meaning.
When you read a program, read it the way the computer does: start at the first instruction, finish that line, then the next. Later you will add loops (repeat a block) and if (choose a block). Until then, assume straight down the page.
Comments are sticky notes
A line that starts with # is a comment. Python skips it. You write comments for the next person — often yourself next week — who will ask “why is this step here?”
Good comments explain intent (“wait 2 minutes so the sugar dissolves”), not the obvious (“this is a print”). In this course, comments also mark the start of a recipe so you can find it later.
A comment does not print
# This line is ignored
print("This line is a real step")
Syntax is spelling for programs
If you misspell a word in English, a reader may still understand you. If you misspell print as pirnt, Python will not. Syntax errors are like a recipe that says “suger” when the kitchen robot only knows “sugar”.
When a program fails, read the message from the top. Fix one problem, run again. Do not change five lines at once — you will not know which change helped.
Words that matter
- Program
- A saved list of instructions a computer can run.
- Syntax
- The spelling and punctuation the language requires.
- Comment
- A # note for humans; Python skips it.
Common mistakes
Avoid: Writing steps in any order because “the computer is smart”.
Do this: Put steps in the real-world order, then test by running.
Avoid: Using comments as the only documentation of a broken program.
Do this: Make the code itself clear; comments explain why, not what is already obvious.
Example program — A three-step lemonade program
Press Run. Each print is one step. Then swap two prints and Run again — the story order changes.
Edit the example, press Run, then Build if you want a compile check.
build
Press Build to compile.
Your turn — Write your own snack recipe
Print three clear steps for making a sandwich. The word sandwich must appear in the output.
Edit the example, press Run, then Build if you want a compile check.
build
Press Build to compile.
Self-assessment
Check your understanding before you mark the lesson complete.
Progress is stored in a browser cookie on this device.