
Exploring Selection Statements in Python
Presentation
•
Computers
•
9th - 12th Grade
•
Easy
N Ellis
Used 22+ times
FREE Resource
10 Slides • 13 Questions
1
Exploring Selection Statements in Python
An exploration of selection statements in Python, including if statements. Learn how to make decisions in your code based on conditions and control the flow of your program.
2
What exactly does this program do?
3
Multiple Choice
Print statement
Outputs a message on the screen
Gets data from the user
A decision
A loop controlled by a decision
4
Multiple Choice
Input statement
Outputs a message on the screen
Gets data from the user
A decision
A loop controlled by a decision
5
Multiple Choice
6
Selection Statements in Python
Selection statements allow us to control the flow of our program based on certain conditions.
Python provides two types of selection statements: if and if-else.
With if statements, we can execute a block of code only if a certain condition is true.
If-else statements allow us to execute different blocks of code based on different conditions.
Selection statements are essential for making decisions and creating dynamic programs.
7
Multiple Choice
What are the two types of selection statements in Python?
if and if-else
for and while
try and except
def and return
8
Multiple Choice
print("Hello world!")
9
if Statement in Python
Trivia: The if statement in Python is used to execute a block of code only if a certain condition is true. It is also used to handle multiple conditions using if, elif, and else. Additionally, it can be used to check for equality using == and inequality using !=. Conditions can also be combined using and and or.
10
Using the else Statement
11
Multiple Choice
What is the purpose of the else statement in Python?
To execute a block of code when the condition is True
To provide an alternative path of execution when the condition is not met
To check multiple conditions at once
To terminate the program
12
Comparison Operators in Python
13
Multiple Choice
What is the symbol for 'less than or equal to' in Python?
==
!=
<=
>
14
Multiple Choice
What does this symbol represent?
>
Less than
Greater than
Equal to
Less than or equal to
15
Indentation in Python
Python requires indentation as part of the syntax
Indentation signifies the start and end of a block of code
Correct indentation is crucial, or the program may either not run, or give an incorrect result
16
Multiple Choice
What is crucial for selection statements in Python?
Indentation
Semicolons
Brackets
Quotation marks
17
If gives you two options
ELIF stands for Else, If and gives you more options
You can use it as many times as you like
The ELIF statement
18
Write a simple program that might be used inside a police speed camera:
The requirements are:
It must accept the driver’s speed
IF the speed is over 70mph, a message “Issue Fine” should appear on the speed gun
Otherwise it should display
“No Action”
Write a program
19
Add an ELIF statement to the Speeding program
Issue a warning between 70 and 75mph
Only issue a fine for 75mph and over
Using the ELIF statement
20
Reorder
Reorder the following
age = int(input("please enter your age "))
if age >= 14
print("welcome to the Club")
else
print("Sorry, you're not old enough to join yet")
21
Multiple Choice
22
Multiple Choice
What is the name of the variable in this program?
colour
input
" "
23
Multiple Choice
Which is NOT a data type in Python?
integer
boolean
anchor
float
Exploring Selection Statements in Python
An exploration of selection statements in Python, including if statements. Learn how to make decisions in your code based on conditions and control the flow of your program.
Show answer
Auto Play
Slide 1 / 23
SLIDE
Similar Resources on Wayground
18 questions
Review of Graphs of Polynomial Functions
Presentation
•
9th - 12th Grade
18 questions
Grammar Lesson: Active vs Passive Voice
Presentation
•
9th - 12th Grade
18 questions
Diction & Tone
Presentation
•
9th - 12th Grade
17 questions
Factoring! Greatest Common Factor
Presentation
•
9th - 12th Grade
17 questions
Start of WWII - Causes of event
Presentation
•
9th - 12th Grade
19 questions
Chemical Bonding
Presentation
•
9th - 12th Grade
16 questions
Computer Science Principles Unit 2 Review
Presentation
•
9th - 12th Grade
21 questions
Cover Letters and Resumes
Presentation
•
9th - 12th Grade
Popular Resources on Wayground
24 questions
PBIS-HGMS Day 10
Quiz
•
6th - 8th Grade
10 questions
HCS SCI 03 Summer School Review 3
Quiz
•
3rd Grade
11 questions
Home Scope
Quiz
•
7th - 8th Grade
15 questions
HCS SCI 05 Summer School Assessment 3 Review
Quiz
•
5th Grade
35 questions
Lufkin Road Middle School Student Handbook & Policies Assessment
Quiz
•
7th Grade
18 questions
Geo 11.3 Area of Circles and Sectors
Quiz
•
9th - 11th Grade