Back to Constructs
N
Oak National Academy
Lessons written by expert teachers in England, each with slides, a video and quizzes.
Their topic:
Introduction to Python programming · Using fundamental programming constructs in a block-based language
For your topic:
Constructs · Computer Science - 4CP0
Use these lessons alongside our lesson note, which covers your syllabus in full.
What this covers in your syllabus
Understand the structural components of a program (variable and type declarations, command sequences, selection, iteration, data structures, subprograms)
Taught in
Lesson 3: Sequence
3 lessons from Oak National Academy
1
Building a program using control structures
2
Problem solving using programming constructs
3
Sequence
Lesson 1 of 3 · Lower secondary, ages 11 to 14
Building a program using control structures
By the end:
I can combine sequence, selection and iteration to build a program that uses complex conditions.
Key learning points
Expressions formed using logical operators evaluate to either True or False.
Logical and relational operators can be combined to create complex conditions.
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
A common mistake
Mistake: Learners often get confused between the logic operators AND and OR.
In fact: For an AND statement to return True both inputs must be True. For an OR statement to return True either input can be True.
Check what you learned
From Oak National Academy's exit quiz. Choose every answer that is right.
Which logical operator in Python would you use to check if at least one of two conditions is True?
`and`
`or`
`not`
`==`
Which logical operator in Python would you use to check if both of two conditions are True?
`and`
`or`
`not`
`=`
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":`
`while True:`
`while not game_over:`
Which of the following is a potential benefit of combining programming structures?
creating more complex programs
making code more concise and efficient
solving a wide range of problems
there is no need for variables
What is the output of the following Python code? ``` is_weekend = True have_homework = False if is_weekend and not have_homework: print("Time to relax") else: print("Time to study.")```
Time to relax
Time to study
An error message will occur.
No output will be produced.
Check answers
A computing lesson by Oak National Academy licensed under the Open Government Licence (OGL) v3.0.
Read the licence
Lesson 2 of 3 · Lower secondary, ages 11 to 14
Problem solving using programming constructs
By the end:
I can combine sequence, selection and iteration in a program to solve a problem.
Key learning points
The programming constructs of sequence, selection and iteration can be combined to make more complex programs.
Analysing a problem involves decomposing it into its constituent parts.
Algorithms can be developed to solve a problem.
A problem can be solved in multiple ways.
Keywords
problem
a situation or task that needs to be solved
decomposition
breaking down a problem into smaller parts to make the task more manageable
solution
a means of solving a problem
A common mistake
Mistake: Programming constructs cannot be combined in the same code block.
In fact: The programming constructs of sequence, selection and iteration can be combined within the same code block to make more complex programs.
A computing lesson by Oak National Academy licensed under the Open Government Licence (OGL) v3.0.
Read the licence
Lesson 3 of 3 · Lower secondary, ages 11 to 14
Sequence
By the end:
I can use subroutines to execute sequences of commands.
Key learning points
Computers only follow the commands they are given, so these need to be precise and accurate.
Commands can be joined together to create sequences in Scratch to achieve a desired outcome.
Sequences can be separated into individual subroutines.
Programs should be written so that other people can easily understand them. Subroutines are used to do this.
Keywords
execute
to run or carry out the commands in a program
sequence
the order of commands in a program
subroutine
a sequence of instructions with an identifiable name that performs a specific task
A common mistake
Mistake: A sprite in Scratch can only have one sequence of code blocks.
In fact: Sequences of code can be separated into subroutines and these subroutines can be called multiple times.
A computing lesson by Oak National Academy licensed under the Open Government Licence (OGL) v3.0.
Read the licence
The wording comes from each publisher. The layout and the links to your syllabus are ours.