Download presentation
Presentation is loading. Please wait.
1
PYTHON: BUILDING BLOCKS 8.2.4 - Sequencing & Selection
Year 8 Computer Science - Midhurst Rother College
2
STARTER CHALLENGE Begin to think about how you might program a guess the number game. Think about the order of steps you would need to take. Think about variables, inputs and outputs. Think about what programming skills you may need to learn. This will be useful for later in the lesson!
3
LESSON OBJECTIVES Be able to explain the importance of sequencing and selection when writing code. Be able to implement these in Python.
4
BUILDING BLOCKS > Sequencing > Selection > Iteration
An algorithm is a plan, a set of step-by-step instructions to solve a problem. There are three basic building blocks to use when designing algorithms. > Sequencing > Selection > Iteration This lesson we are going to focus on sequencing and selection.
5
SEQUENCING Algorithms consist of instructions that are carried out one after another. Sequencing is the specific order in which instructions are performed in an algorithm. It is crucial that the steps in an algorithm are performed in the right order - otherwise the algorithm will not work correctly. CLASS DISCUSS: What are the process involved in brushing your teeth? Why would sequencing be important?
6
SEQUENCING IN PYTHON In Python, we sequence from top to bottom.
This code would not work due to errors in its sequencing. What are these errors? How could we write this code correctly?
7
SEQUENCING IN PYTHON We must make sure a variable has a value before we can use it. We must make sure our variables are ready before we print them.
8
SELECTION Selection is a decision or question.
At some point in an algorithm there may need to be a question because the algorithm has reached a step where one or more options are available. Depending on the answer given, the algorithm will follow certain steps and ignore others. Without selection, different paths would not be included in algorithms. This means that the solutions created would not be realistic. CLASS DISCUSS: Have we used selection already?
9
We use an ‘If Else’ Statement in Python.
SELECTION IN PYTHON We use an ‘If Else’ Statement in Python.
10
We use an ‘elif’ in Python if we need more than two outcomes.
SELECTION IN PYTHON We use an ‘elif’ in Python if we need more than two outcomes.
11
COMPARISON OPERATORS Comparison operators are used to compare two values. An expression using a comparison operator evaluates to be True or False. How could you use this in creating a program?
12
YOUR TASK Start the tasks in the sequence & selection task sheet found on rother-net.co.uk. Work your way through the tasks. Remember in your workbook to: Read the work carefully. Open any other tasks needed. At the end of a lesson in the box for this topic add a screenshot of the most complex task you got working. Update your keyword table.
13
TASK DISCUSS: Did you complete the tasks? Did you have any issues?
Could you program a guess the number game? How did you do it?
14
YOUR EVIDENCE Remember in your workbook to:
In the box for this topic add a screenshot of the most complex task you got working. Write a short paragraph of what you learnt this lesson. Did you face any challenges? How did you overcome them? Did you face any errors (e.g. syntax)? How did you find and correct them? Update your keyword table.
15
THINGS TO REMEMBER From the unit so far, you need to remember what the following mean: Algorithm Variable Function Input / Output Data Types Casting Sequencing Selection Can you remember?
16
PLENARY Work Showcase Q & A Choose a student’s program.
Allow other students to ask questions about the code. Discuss how programs could be improved. PLENARY Work Showcase Q & A
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.