Computer Science
Grade 7
20 min
Lesson 4: Pseudocode: Writing Algorithms in Plain English
Introduce pseudocode as a way to describe algorithms without using specific programming language syntax.
Tutorial Preview
1
Introduction & Learning Objectives
Learning Objectives
Define pseudocode and explain its purpose in program planning.
Differentiate between pseudocode and a formal programming language like Python or JavaScript.
Write a simple sequential algorithm using standard pseudocode keywords.
Use IF/THEN/ELSE structures in pseudocode to represent decisions.
Use WHILE loops in pseudocode to represent repetition.
Translate a real-world task into a clear, step-by-step pseudocode algorithm.
Ever tried to explain a TikTok dance to a friend who just doesn't get it? 🕺 What if you could write the steps so perfectly that even a robot could do it?
In this lesson, you'll learn how to write instructions for computers using a special kind of 'fake code' called pseudocode. It's a powerful tool that helps y...
2
Key Concepts & Vocabulary
TermDefinitionExample
AlgorithmA set of step-by-step instructions designed to perform a specific task or solve a problem.A recipe for baking a cake is an algorithm. You follow the steps in order to get the final result.
PseudocodeA way of writing an algorithm using a mix of plain English and simple programming-like keywords. It's a 'draft' for your real code.Instead of complex code, you might write: `GET user_age. IF user_age < 13 THEN PRINT 'Access denied.'`
SequenceThe order in which instructions are executed, one after another, from top to bottom.1. `GET bread`. 2. `GET peanut butter`. 3. `SPREAD peanut butter on bread`.
Selection (Condition)A decision point in an algorithm that allows it to follow different paths based on whether a condition is true or fals...
3
Core Syntax & Patterns
Keywords for Actions
Use capitalized, clear action words: `GET`, `SET`, `PRINT`, `CALCULATE`, `READ`, `DISPLAY`.
Use these common keywords to represent computer actions like getting input, setting a variable's value, or displaying output. This makes your pseudocode easy for anyone to read and understand.
IF/THEN/ELSE for Decisions
`IF [condition is true] THEN [do this action] ELSE [do this other action] ENDIF`
Use this structure to show a decision. The computer checks the condition. If it's true, it does the 'THEN' part. If it's false, it does the 'ELSE' part. The `ELSE` is optional.
WHILE/DO/ENDWHILE for Loops
`WHILE [condition is true] DO [repeat these actions] ENDWHILE`
Use this to repeat a block of instructions. The computer che...
4 more steps in this tutorial
Sign up free to access the complete tutorial with worked examples and practice.
Sign Up Free to ContinueSample Practice Questions
Challenging
What is the final output of this pseudocode? `SET count = 1 SET message = "" WHILE count <= 3 DO IF count == 2 THEN SET message = message + "B" ELSE SET message = message + "A" ENDIF SET count = count + 1 ENDWHILE PRINT message`
A.A
B.AB
C.ABA
D.AAB
Challenging
The 'Homework Checker' algorithm needs to stop ONLY when the user types 'yes'. What is the logical flaw in this version? `SET homework_done = "no" WHILE homework_done == "no" DO PRINT "Is your homework done?" GET homework_done ENDWHILE`
A.It will stop if the user types anything other than 'no', such as 'yep' or 'finished'.
B.It will never stop because `homework_done` is always 'no'.
C.It will not ask the question the first time.
D.The `GET` command should be outside the loop.
Challenging
An algorithm for a guessing game is written as follows: `SET secret_number = 7 GET user_guess WHILE user_guess != secret_number DO IF user_guess < secret_number THEN PRINT "Too low!" ELSE PRINT "Too high!" ENDIF ENDWHILE PRINT "You got it!"` What is the critical flaw in this algorithm's logic?
A.The `secret_number` should be a variable, not a fixed number.
B.It will print 'Too high!' even when the guess is correct.
C.It uses an `IF/ELSE` statement inside a `WHILE` loop, which is not allowed.
D.It never asks the user for a new guess inside the loop, creating an infinite loop if the first guess is wrong.
Want to practice and check your answers?
Sign up to access all questions with instant feedback, explanations, and progress tracking.
Start Practicing Free