Hello again, future software engineer! In Module 1, you learned how to think like an engineer. Now it’s time to start building! Just like a builder uses bricks, cement, and wood, a software engineer uses variables, data types, and instructions to create programs.
In this module, we will learn the most basic parts of any programming language. We will not use a specific language (like Python or JavaScript) – instead, we will learn the ideas that work in every language. Once you understand these ideas, you can learn any coding language easily!
We will learn how to store information, how to name it, and how to give simple instructions. We will also learn how to make decisions using conditions. By the end, you will be able to write your first simple programs – on paper or on a computer. Let’s jump in!
After this module, you will be able to:
Ada’s mum gave her a shopping list: “Buy 2 loaves of bread, 5 apples, and 1 bottle of juice.” Ada went to the shop. She remembered “2”, “5”, and “1” – but when she reached the shop, she forgot what the 2 was for! Was it bread? Or apples?
So Ada took a notebook and wrote:
bread = 2 apples = 5 juice = 1
Now she knew exactly what each number meant. When she bought the items, she crossed them off. She even changed the numbers: bread = 1 (after buying one).
Her notebook acted like a computer’s memory. Each item name was a variable, and the number was its value. That is exactly how programs work – they store information in variables so they can use it later.
Now let’s learn how to do that with code!
Definition: A variable is a named container that holds a piece of information. It’s like a labelled box where you store something.
Why is it important? Without variables, a computer could not remember anything – it would forget everything after each step!
Simple explanation: Imagine a jar labelled “cookies”. You can put 10 cookies in it, or take some out. The jar always has a name, and the number of cookies inside can change. That’s a variable.
Real‑life example: Your school locker – you put books in it, and you can change what’s inside. The locker has a number (like Locker 42) – that’s the variable name, and the books are the value.
School example: Your test score – you might have a score of 85. Later, you get 90. The variable is “score”, and its value changes.
Home example: Your piggy bank – the variable is “piggyBank”, and the value is the amount of money inside.
Nigerian example: The number of people in a bus – the variable is “passengers”, and its value changes as people get on and off.
Illustration:
+-------------+ | name: age | ← variable name | value: 10 | ← variable value +-------------+
Mini summary: A variable is a labelled box that holds a piece of information that can change.
Definition: Data types tell the computer what kind of information a variable holds – like a number, a word, or a yes/no answer.
Why is it important? Because the computer needs to know how to handle the information. You can do math with numbers, but not with words.
Simple explanation: Think of three different boxes: one for numbers (like your age), one for words (like your name), and one for true/false (like “is it raining?”).
Real‑life example: A form asks for your name (text), age (number), and whether you are a student (true/false).
School example: Your teacher records your name (text), your test score (number), and if you did homework (true/false).
Home example: A recipe: 2 cups of flour (number), “sugar” (text), and “oven is hot?” (true/false).
Nigerian example: In a bank app: your account number (text), balance (number), and “is account active?” (true/false).
Illustration:
+----------------+------------------+------------------+ | Number | Text | True/False | | (integer) | (string) | (boolean) | +----------------+------------------+------------------+ | 10, 3.14, 0 | "Hello", "Ada" | true, false | +----------------+------------------+------------------+
Mini summary: Data types help the computer understand what kind of data it is working with – numbers, text, or true/false.
Definition: Naming variables means giving them clear, descriptive names so you and others know what they represent.
Why is it important? Good names make your code easy to read and understand – like having clear labels on boxes.
Simple explanation: If you name a variable “x”, nobody knows what it means. But if you name it “score”, everyone knows it holds a score.
Real‑life example: A teacher’s attendance sheet has columns like “Name”, “Absent”, “Tardy” – clear names.
School example: Your notebook headings: “Math Homework”, “Science Notes” – clear names.
Home example: Storage boxes labelled “Christmas Decorations” or “Winter Clothes”.
Nigerian example: A market trader labels baskets: “Tomatoes”, “Onions”, “Peppers” – not “Box1”, “Box2”.
Rules for naming:
first_name.totalScore is better than ts.Illustration:
✅ Good: playerName, age, isHungry ❌ Bad: p, a, 1var, my variable
Mini summary: Use clear, descriptive names for your variables – it helps everyone understand your code.
Definition: Assigning means putting a value into a variable. We use the assignment operator (usually =) to do this.
Why is it important? Because a variable is empty until you assign a value to it.
Simple explanation: It’s like saying “my piggy bank has 100 naira” – you are putting the value 100 into the variable “piggyBank”.
Real‑life example: You set your alarm clock to 7:00 – you are assigning the value 7 to the variable “alarmTime”.
School example: The teacher sets the score for your test: score = 85.
Home example: You tell your smart speaker the volume: volume = 5.
Nigerian example: You set your mobile data to “1GB” – that’s assigning a value.
Illustration:
age = 10 ← assignment ↑ ↑ name value
Mini summary: Assignment is putting a value into a variable using the equals sign.
Definition: Reading means using the value stored in a variable. You can use it in calculations, display it, or compare it.
Why is it important? Because storing data is useless if you can’t use it later!
Simple explanation: Like checking your piggy bank to see how much money you have – you read the value.
Real‑life example: Your phone displays your battery percentage – it reads the variable “batteryLevel”.
School example: Your teacher reads your name from the attendance list.
Home example: You check the temperature on your thermostat.
Nigerian example: A POS machine reads your account balance before a withdrawal.
Illustration:
age = 10 print(age) ← reads and displays the value (10)
Mini summary: Reading a variable means using its value.
Definition: Changing a variable means giving it a new value. The old value is replaced.
Why is it important? Because programs need to update information – like a game score that increases.
Simple explanation: You start with 10 cookies, you eat 2, now you have 8. The value changes.
Real‑life example: A football score starts at 0, then becomes 1, then 2 – the variable “score” changes.
School example: Your class attendance increases by 1 each day.
Home example: Your savings grow as you add money.
Nigerian example: The number of passengers on a bus changes at each stop.
Illustration:
score = 0 ← initial value score = 1 ← new value, old 0 is gone score = score + 1 ← adds 1 to current score (now 2)
Mini summary: You can change a variable by assigning a new value.
Definition: A statement is a single instruction that the computer executes – like a command.
Why is it important? Programs are made of many statements – they are the building blocks of code.
Simple explanation: It’s like saying “walk forward” – that’s one instruction.
Real‑life example: “Turn on the light” is a statement you give to your smart home.
School example: “Open your book” is a statement from the teacher.
Home example: “Set the timer for 10 minutes” is a statement.
Nigerian example: “Add 500 naira to my account” is a statement in a banking app.
Illustration:
// These are statements: age = 10 print(age) age = age + 1
Mini summary: A statement is one command that the computer performs.
Definition: A condition is a question that has a yes/no answer. Programs use conditions to decide what to do next.
Why is it important? Without conditions, programs would do the same thing every time – boring!
Simple explanation: “If it is raining, take an umbrella” – that’s a condition. If the answer is yes, you act; if no, you don’t.
Real‑life example: If your phone battery is below 20%, it shows a warning.
School example: If you score above 80, you get an A.
Home example: If the door is locked, you use a key.
Nigerian example: If the traffic light is red, you stop.
Illustration:
if (temperature > 30) {
wear_light_clothes()
} else {
wear_heavy_clothes()
}
Mini summary: Conditions let your program make choices based on true/false questions.
Definition: Comparison operators are symbols that compare two values and give a true/false answer. Examples: >, <, ==, !=, >=, <=.
Why is it important? They allow us to write conditions.
Simple explanation: You compare numbers: “Is 10 greater than 5?” Yes! “Is 10 equal to 5?” No!
Real‑life example: “Is your age >= 18?” Then you can vote.
School example: “Is your score > 70?” Then you pass.
Home example: “Is the fridge temperature > 4?” Then it’s too warm.
Nigerian example: “Is your bank balance > 1000?” Then you can withdraw.
Illustration:
5 == 5 → true 5 > 3 → true 5 < 3 → false 5 != 3 → true
Mini summary: Comparison operators ask questions and return true or false.
Definition: Logical operators combine two or more conditions. The main ones are AND, OR, and NOT.
Why is it important? Sometimes you need more than one condition to be true.
Simple explanation: “If it is raining AND I have an umbrella, I will go out.” Both must be true.
Real‑life example: A website asks: “If you are 18+ AND you agree to terms, you can sign up.”
School example: “If you did homework AND you studied, you will pass.”
Home example: “If the door is closed AND the window is locked, then the house is secure.”
Nigerian example: “If you have a valid ID AND you are on the list, you can vote.”
Illustration:
age >= 18 AND hasID == true → true only if both are true isWeekend OR isHoliday → true if either is true NOT isRaining → true if it is NOT raining
Mini summary: Logical operators combine conditions to form more complex questions.
Definition: Input is data that the program receives from the user, like a name or a number.
Why is it important? Programs become interactive – they respond to what you tell them.
Simple explanation: When a game asks “What is your name?” and you type it – that’s input.
Real‑life example: You type your username and password to log in.
School example: You answer a question on a quiz app.
Home example: You tell your smart speaker to set an alarm.
Nigerian example: You enter your phone number to recharge airtime.
Illustration:
name = input("What is your name?") ← user types "Ada"
print("Hello " + name)
Mini summary: Input allows the user to give data to the program.
Definition: Output is the information that the program gives back to the user – like displaying a result on the screen.
Why is it important? Without output, you wouldn’t know what the program did!
Simple explanation: When you add two numbers on a calculator and it shows the sum – that’s output.
Real‑life example: A weather app shows the temperature – that’s output.
School example: The computer displays your test score.
Home example: Your microwave beeps and shows “DONE”.
Nigerian example: A POS machine prints a receipt – that’s output.
Illustration:
print("Welcome to the game!")
print("Your score is " + score)
Mini summary: Output shows the user the results of the program.
Definition: You can combine variables to create new values. For example, adding numbers or joining text together.
Why is it important? This lets you build more complex information.
Simple explanation: If you have “first name” and “last name”, you can join them to get “full name”.
Real‑life example: In a game, your score is the sum of points from different levels.
School example: Your total grade is the average of all your test scores.
Home example: Your total savings = pocket money + gifts.
Nigerian example: Your monthly airtime = your recharge + bonus.
Illustration:
total = price + tax fullName = firstName + " " + lastName
Mini summary: You can use variables together to compute new values.
Definition: Pseudo‑code is a way to write algorithms that looks like code but is easy to read – it is not a real programming language.
Why is it important? It helps you plan your code before you write it in a specific language.
Simple explanation: It’s like writing a recipe in your own words – not in a special cooking language.
Real‑life example: A teacher writes the steps of a math problem on the board in plain English.
School example: You write the steps to solve a problem before actually solving it.
Home example: You write a to‑do list using simple words.
Nigerian example: A planner writes the steps for organising a community event.
Illustration:
// Pseudo-code to calculate grade
INPUT score
IF score >= 70 THEN
grade = "A"
ELSE
grade = "B"
END IF
PRINT grade
Mini summary: Pseudo‑code is a simple way to write algorithms without worrying about strict syntax.
Definition: Code is used in almost every electronic device – from phones to traffic lights.
Why is it important? It shows you that coding skills are useful in many areas.
Simple explanation: Every app, game, and website runs on code.
Real‑life example: Your calculator, your smartwatch, your TV remote – all contain code.
School example: The school portal, the lunch ordering system – all code.
Home example: Your Wi‑Fi router, your fridge with a screen – all code.
Nigerian example: The e‑Naira app, the NIN registration – all built with code.
Illustration:
+-------------------+ | Code is Everywhere | | Phones, Cars, Games, | | ATMs, Traffic Lights | +-------------------+
Mini summary: Code is everywhere – learning it opens many doors!
| Word | Simple Definition |
|---|---|
| Variable | A named box that holds a value. |
| Data Type | The kind of data: number, text, or true/false. |
| Assignment | Putting a value into a variable. |
| Statement | A single instruction in a program. |
| Condition | A question that is true or false. |
| Comparison Operator | Symbols like >, <, == to compare values. |
| Logical Operator | AND, OR, NOT to combine conditions. |
| Input | Data that the user gives to the program. |
| Output | Data that the program shows to the user. |
| Pseudo‑code | Plain‑language description of an algorithm. |
This module introduces the fundamental building blocks of programming. Focus on concepts over syntax. Use physical objects (like boxes or jars) to demonstrate variables. Encourage students to write pseudo‑code for everyday tasks. Emphasise that naming variables well is a sign of a good engineer.
Ask your child to identify variables in daily life – e.g., “What variables do we have when cooking?” (ingredients, quantities). Encourage them to think about conditions: “If it rains, what do we do?”. This strengthens their logic and prepares them for coding.
= instead of == in conditions – = is assignment, == is comparison.score not s.
Start
|
v
Is score >= 70?
/ \
Yes No
| |
v v
Pass Fail
| |
v v
End End
| Type | What it holds | Example |
|---|---|---|
| Integer | Whole numbers | 10, 0, -5 |
| Float | Decimal numbers | 3.14, 2.0 |
| String | Text | "Hello", "Ada" |
| Boolean | True or False | true, false |
| Operator | Meaning | Example |
|---|---|---|
| == | equal to | 5 == 5 → true |
| != | not equal to | 5 != 3 → true |
| > | greater than | 5 > 3 → true |
| < | less than | 5 < 3 → false |
| >= | greater than or equal | 5 >= 5 → true |
| <= | less than or equal | 5 <= 3 → false |
You have completed Module 2, and you now understand the core building blocks of all programming languages. You learned about variables – how to name them, assign values, and change them. You discovered different data types – numbers, text, and true/false. You also learned how to write statements, ask questions with conditions, and combine conditions with logical operators. Finally, you explored input and output, and you practiced writing pseudo‑code.
Remember: a program is just a series of instructions that manipulate variables. With these skills, you can start building simple programs – even games! You are now ready to learn a real programming language in Module 3.
= and ==? = is assignment, == is comparison.== operator do?= and ==?== is used for assignment. (False)age > 18 mean?!= mean?| Term | Definition |
|---|---|
| 1. Variable | A. A question that is true or false |
| 2. Data Type | B. A named container for data |
| 3. Condition | C. Kind of data: number, text, boolean |
| 4. Assignment | D. Putting a value into a variable |
| 5. Output | E. Data shown to the user |
Answers: 1‑B, 2‑C, 3‑A, 4‑D, 5‑E
Scenario 1: You are building a simple game. The player has 3 lives. Every time they lose, a life is removed. Write the pseudo‑code for this scenario.
Scenario 2: A school wants to check if a student has passed. If the score is 50 or above, they pass; otherwise, they fail. Write the pseudo‑code for this.
In groups, choose a simple task (e.g., making a sandwich, planning a school event). Write down the steps (algorithm) for that task. Then, swap with another group and see if they can follow your steps. Discuss any missing details. This shows how clear instructions are crucial in software.
Write a simple pseudo‑code program that asks the user for their name and age, then prints “Hello, [name]! You are [age] years old.”
Create a Simple Quiz: Write a pseudo‑code program that asks the user a question, checks if the answer is correct, and prints “Correct!” or “Try again!”. Use variables and conditions.
Write a pseudo‑code program that calculates the total cost of items in a shop. Use variables for price and quantity. The program should ask for the price and quantity, then display the total. Include a condition: if the total is above 1000, give a 10% discount.
Design a simple “Guess the Number” game using pseudo‑code. The program picks a secret number (e.g., 5). The user guesses a number. If the guess is correct, print “You win!”. If the guess is too high or too low, give a hint.
Fill‑in‑the‑Blank: 1. variable, 2. text/string, 3. comparison, 4. Input, 5. Output, 6. statement, 7. Pseudo‑code, 8. AND, 9. OR, 10. descriptive.
True/False: 1F, 2T, 3F, 4T, 5F, 6F, 7F, 8T, 9F, 10T.
Multiple Choice: 1B, 2A, 3B, 4B, 5B, 6B, 7A, 8B, 9B, 10A, 11A, 12B, 13A, 14B, 15D.
In Module 3, you will learn a real programming language! We will start with simple programs that use variables, conditions, and loops. You will also learn how to write code that actually runs on a computer. To prepare, think about what you would like to build – a game? A calculator? Bring your ideas to the next class!
Fantastic work, young coder! See you in Module 3! 🚀