1. What is a program?
A program is a set of instructions that tells a computer what to do. Computers are fast but not clever. They only do exactly what we tell them.
Think about making a cup of tea. You know to boil the kettle before pouring water into the cup. A computer needs that same order of steps written down.
2. Algorithms
An algorithm is a step-by-step plan for solving a problem. It doesn’t have to be in code. A recipe is an algorithm!
Algorithm for making toast:
- Take a slice of bread.
- Put it in the toaster.
- Push the lever down.
- Wait until it pops up.
- Add butter.
You try
Write an algorithm with 5–7 steps for brushing your teeth. Swap with a partner. Did you miss any steps they thought were obvious?
3. Variables
A variable is a named box that stores a piece of information so we can use it later. Picture a labelled drawer.
# Variables in Python name = "Ava" age = 13 score = 0
The name on the left is the label; the value on the right is what’s in the drawer. You can change what’s in the drawer at any time.
| Type | Holds | Example |
|---|---|---|
| String | text | "hello" |
| Integer | whole number | 42 |
| Float | decimal number | 3.14 |
| Boolean | true or false | True |
4. Decisions (if / else)
Programs make decisions using if statements. The computer checks a condition, then chooses what to do.
if score >= 10: print("Well done!") else: print("Keep trying.")
Read it in English: “If the score is at least 10, say ‘Well done!’. Otherwise, say ‘Keep trying.’”
5. Loops
A loop repeats a block of code. Instead of writing the same thing 10 times, we tell the computer to repeat.
for i in range(5): print("Hello!")
This prints “Hello!” five times. Loops are what make games, animations and data processing possible.
6. Bugs & debugging
A bug is a mistake in your code. Debugging is the skill of finding and fixing bugs. Every programmer (even experts) writes bugs. That’s normal.
- Read the error message carefully; it usually points to the line.
- Check your spelling and capital letters.
- Try the smallest possible version of your code to isolate the problem.
- Explain the code out loud to a classmate (or a rubber duck!).
Glossary
- Algorithm
- A step-by-step plan to solve a problem.
- Variable
- A named store for data.
- Condition
- An expression that is either true or false.
- Loop
- A block of code that repeats.
- Bug
- A mistake in a program.
- Syntax
- The grammar rules of a programming language.