New! Explore our Programming Academy and AI Tutor - learn to code from scratch, free to start. Explore Now
Learn› Secondary› Computer Studies / ICT› Algorithms and Simple Programming

Algorithms and Simple Programming

Write clear algorithms and translate one into simple code.

~17 min Computer Studies / ICT
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

  1. Write an algorithm for making a cup of tea.
  2. Write pseudocode to check whether a number is even or odd.
  3. 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 Notes

Contents

Course contents

Digital Skills

0/3 lessons completed

Lesson sections