Algorithms and Simple Programming
Write clear algorithms and translate one into simple code.
0 of 3 completed
An algorithm is a finite, ordered set of steps that solves a problem.
In this lesson you will:
- Write an algorithm for a daily task.
- Identify sequence, selection and repetition.
- Translate an algorithm into simple code.
Three Building Blocks
- Sequence — steps in order.
- Selection — a decision (if/else).
- Repetition — a loop that repeats steps.
Example Algorithm
To find the larger of two numbers: start; read A and B; if A is greater than B, display A; otherwise display B; stop.
From Algorithm to Code
A program is an algorithm written in a language the computer can run. The same logic works in Python, JavaScript or pseudocode.
Python version
a = int(input("Enter A: "))b = int(input("Enter B: "))
if a > b:
print(a)
else:
print(b)
Tip Write the algorithm in plain words before you write code. If the steps are unclear, the program will be unclear too.
Practice
- Write an algorithm for making a cup of tea.
- Write pseudocode to check whether a number is even or odd.
- Explain the difference between selection and repetition.
Recap
Algorithms use sequence, selection and repetition. Code is an algorithm written in a programming language.
Test what you just learned
Take the topic quiz to check your understanding and earn points.
Take Quiz →
AI Notes
Get AI-powered summaries, key points, and quick revision notes for this lesson — available with Premium.
Unlock AI NotesContents
Course contents
Digital Skills
0/3 lessons completed