
S3 SDD - selection statements
Presentation
•
Computers
•
3rd Grade
•
Practice Problem
•
Hard
G Alexander-Doyle
Used 9+ times
FREE Resource
7 Slides • 6 Questions
1
Selection statements
Python programming
2
Decisions
Real life is full of examples of consequences which occur when you make a decision. For example if you fail to complete maths or computing homework you may be given a detention or the school may contact home.
Similarly if you complete homework regularly to a good standard you would likely receive a star or be nominated for pupil of the month in the department.
3
Decisions in programming
A program can also make decisions and perform an action based around a condition being true. It can do this by using a selection statement. The words if and else are used to indicate which action should be performed in the event of a condition being true or false.
4
Decisions in programming
All programming languages will support the use of slection statements, they are a commonly used construct.
5
Fill in the Blanks
If the current score is 62, what is the variable powerUp set to?
Type answer...
6
Decisions in programming
The following is an example of a simple IF... THEN ELSE... selection statement. it has been written in the SQA's reference language (this is a language which is similar to pseudocode).
7
Comparison operators
When coding selection statements in Python the following operators can be used:
Operator | Description |
|---|---|
== | Equal to |
> | Greater than |
< | Less than |
>= | Greater than or equal to |
<= | Less than or equal to |
!= | Not equal to |
8
Comparison operators
When coding a selection statement, you must include the following:
Indentation - To indicate what line of code is run if a condition is met.
Colon - To indicate the beginning of a selection statement or loop.
9
Multiple Choice
Which of the following is used to indicate the beginning of a selection statement?
semi-colon
indentation
hash tag
colon
10
Fill in the Blanks
The purpose of this program is to determine whether a pupil has passed a computing science test. A score of at least 50% would result in a pass.
Which operator is missing from the code shown?
Type answer...
11
Fill in the Blanks
The purpose of this program is to determine whether a person receives a free ticket to a football match. Anyone under the age of 12 can claim a free ticket.
Which operator is missing from the code shown?
Type answer...
12
Fill in the Blanks
The purpose of this program is to gather a number to be used in a calculation. The number must be a positive integer.
Write the missing half line of code.
Type answer...
13
Fill in the Blanks
The purpose of this program is to determine whether the user is able to access the members only section of a website. Members can enter using the password "DiamondPass".
Write the missing line of code.
Type answer...
Selection statements
Python programming
Show answer
Auto Play
Slide 1 / 13
SLIDE
Similar Resources on Wayground
10 questions
subtraçao
Presentation
•
3rd Grade
10 questions
Multiplication and Division
Presentation
•
3rd Grade
11 questions
Desktop Background
Presentation
•
4th Grade
11 questions
Stepwise Thinking
Presentation
•
4th Grade
9 questions
Day 4: Main Idea and Details Sharks
Presentation
•
3rd Grade
8 questions
Input & Output Tables
Presentation
•
3rd Grade
11 questions
Teks Surat Lamaran Kerja
Presentation
•
3rd Grade
11 questions
Main Idea and Details
Presentation
•
3rd Grade
Popular Resources on Wayground
6 questions
PRIDE Always and Everywhere
Presentation
•
12th Grade
20 questions
Lab Safety Quiz
Quiz
•
6th Grade
26 questions
KOR Review Kahoot Questions
Quiz
•
8th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
12 questions
Unit Zero lesson 2 cafeteria
Presentation
•
9th - 12th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
10 questions
Riddles Riddles fun Riddles
Quiz
•
6th - 12th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade