icon-background-square
New
New
Year 8

Building a program using control structures

I can combine sequence, selection and iteration to build a program that uses complex conditions.

icon-background-square
New
New
Year 8

Building a program using control structures

I can combine sequence, selection and iteration to build a program that uses complex conditions.

warning

These resources will be removed by end of Summer Term 2025.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

Lesson details

Key learning points

  1. Expressions formed using logical operators evaluate to either True or False.
  2. Logical and relational operators can be combined to create complex conditions.
  3. The programming constructs of sequence, selection and iteration can be combined to make more complex programs.

Keywords

  • Condition - an expression that evaluates to True or False

  • Selection - used when there is more than one possible path for a program to follow

  • Iteration - the process of repeating a sequence of instructions within a program loop

Common misconception

Learners often get confused between the logic operators AND and OR.

For an AND statement to return True both inputs must be True. For an OR statement to return True either input can be True.


To help you plan your year 8 computing lesson on: Building a program using control structures, download all teaching resources for free and adapt to suit your pupils' needs...

The final activity for this lesson is broken down into three stages, which get progressively more challenging to solve. Some pupils may only achieve the first stage but will still have had the opportunity to implement some of the skills and knowledge they have developed over the unit.
speech-bubble
Teacher tip
equipment-required

Equipment

All pupils require access to devices that can edit and run Python programs. Starter code files are available to copy or use directly via the Raspberry Pi Code Editor.

copyright

Licence

This content is © Oak National Academy Limited (2025), licensed on Open Government Licence version 3.0 except where otherwise stated. See Oak's terms & conditions (Collection 2).

Lesson video

Loading...

6 Questions

Q1.
What is the term for repeating a sequence of instructions multiple times in a program?
selection
Correct answer: iteration
condition
randomisation
Q2.
In Python, which code is used to create a loop that repeats as long as a condition is True?
if
for
Correct answer: `while`
else
Q3.
What operator should be added to the gap to make the while loop run whilst the name entered is not equal to Sam?
1
while name {operator here} "Sam":
==
=
Correct answer: !=
>=
Q4.
What is the primary purpose of a flag in programming?
to store a numerical value
Correct answer: to indicate whether a specific condition has been met
to perform mathematical calculations
to display output on the screen.
Q5.
In a game, a player earns bonuses for collecting a certain number of coins. Which of the following would most likely cause a flag named bonus_earned to be set to True?
The player loses a life.
Correct answer: The player collects a set number of coins.
The player quits the game.
The player completes a level.
Q6.
A flag can have two states and False.
Correct Answer: True, true

5 Questions

Q1.
Which logical operator in Python would you use to check if at least one of two conditions is True?
and
Correct answer: `or`
not
==
Q2.
Which logical operator in Python would you use to check if both of two conditions are True?
Correct answer: `and`
or
not
=
Q3.
Which of these Python
while
loop conditions will keep the loop running forever, no matter what happens inside the loop?
while count < 10:
while user_input != "quit":
Correct answer: `while True:`
while not game_over:
Q4.
Which of the following is a potential benefit of combining programming structures?
Correct answer: creating more complex programs
Correct answer: making code more concise and efficient
Correct answer: solving a wide range of problems
there is no need for variables
Q5.
What is the output of the following Python code?
1234567
is_weekend = True have_homework = False if is_weekend and not have_homework: print("Time to relax") else: print("Time to study.")
Correct answer: Time to relax
Time to study
An error message will occur.
No output will be produced.