1/26
Structured Algorithm and Programming Chapter 6 For Foundation Students September 2023 Intake Chapter 6 = Selection (Python)
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What does Control Structure Do in a Python
Control the flow of execution in a program.
Control Structures
Control Structures’s benefit is that it enables you to ______________________________ into a single logical unit with one entry point and one exit point.
combine individual instructions
Control Structures
How many Control Structures that we learn?
3
######################################################################
If you see this, just press Yes. This is a TRIAL TEST
Control Structures
There are 3 types of Control Structures that we use in Python.
1) Sequence
2) Selection
3) Repetition
Equals: a == b
Not Equals: a != b
Less than: a < b
Less than or equal to: a <= b
Greater than: a > b
Greater than or equal to: a >= b
Yes
Relational Operators
Python supports the usual logical conditions from mathematics.
What is the most common way of using relational operators?
‘if statement’
loop
Relational Operators
Python supports the usual logical conditions from mathematics.
What is the other name for “Relational Operator”?
Comparison Operator
Relational Operators
What are the examples of Logical Operator?
and, or, not
Relational Operators
Python supports the usual logical conditions from mathematics.
@
Equals: _______________
@
Choose the correct example of the symbol.
a == b
Relational Operators
Python supports the usual logical conditions from mathematics.
@
Not Equals: _______________
@
Choose the correct example of the symbol.
a != b
Relational Operators
Python supports the usual logical conditions from mathematics.
@
Less than: _______________
@
Choose the correct example of the symbol.
a < b
Relational Operators
Python supports the usual logical conditions from mathematics.
@
Less than or equal to: _______________
@
Choose the correct example of the symbol.
a <= b
Relational Operators
Python supports the usual logical conditions from mathematics.
@
Greater than: _______________
@
Choose the correct example of the symbol.
a > b
Relational Operators
Python supports the usual logical conditions from mathematics.
@
Greater than or equal to: _______________
@
Choose the correct example of the symbol.
a >= b
######################################################################
If you see this, just press Yes. This is a TRIAL TEST
Logical Operator
@
If you put ‘and’, you must make sure that all of the conditions is/are correct to make the result True.
If you put ‘or’, you must ensure that at least one condition is/are correct to make the result True.
If you put ‘not’, you must ensure that the condition linked to it is incorrect to make the result True.
If you put ‘not’, you must ensure that the condition linked to it is correct to make the result False.
@
Fill the blank
Yes
Logical Operator
@
If you put ‘and’, you must make sure that _______________ is/are correct to make the result True.
@
Fill the blank
all of the conditions
Logical Operator
@
If you put ‘or’, you must ensure that _______________ is/are correct to make the result True.
@
Fill the blank
at least one condition
Logical Operator
@
If you put ‘not’, you must ensure that the condition linked to it is __________ to make the result True.
@
Fill the blank
incorrect
Logical Operator
@
If you put ‘not’, you must ensure that the condition linked to it is _______ to make the result False.
@
Fill the blank
correct
Selection Control Structure
‘if statement’ is written using the if keyword as the beginning.
when you put an ‘if’, the Python will check the first condition. If the first condition is _____A_____, then Python will read the ‘elif’ keyword. If all previous conditions are ____A______, then Python will read the ‘else’ keyword.
Python will read the conditions until it meets the condition that is correct. After that, it will not read the rest.
Fill A
incorrect
Selection Control Structure
There are three different situations when using the ‘if statement’
1) One alternative = __________
2) Two alternatives = __________
3) Multiple alternatives = __________
Fill the first blank
if
Selection Control Structure
There are three different situations when using the ‘if statement’
1) One alternative = __________
2) Two alternatives = __________
3) Multiple alternatives = __________
Fill the second blank
if…else
Selection Control Structure
There are three different situations when using the ‘if statement’
1) One alternative = __________
2) Two alternatives = __________
3) Multiple alternatives = __________
Fill the third blank
if…elif…else
What is a nested if?
A condition when you have ‘if statement’ inside another ‘if statement’
Which is a nested ‘if statement’?
@
mangkuk = 65
if mangkuk > 20:
_____ if mangkuk > 40:
_____ _____ print("Mangkuk lebih dari 40")
_____ else:
_____ _____ print("Pelik sungguh mangkuk ni")
else:
_____ print("Aik kenapa dengan mangkuk ni?")
@
_____ if mangkuk > 40:
_____ _____ print("Mangkuk lebih dari 40")
_____ else:
_____ _____ print("Pelik sungguh mangkuk ni")
Select the correct output
@
mangkuk = 65
if mangkuk > 20:
_____ if mangkuk > 40:
_____ _____ print("Mangkuk lebih dari 40")
_____ else:
_____ _____ print("Pelik sungguh mangkuk ni")
else:
_____ print("Aik kenapa dengan mangkuk ni?")
@
Mangkuk lebih dari 40
Select the correct output
@
mangkuk = 26
if mangkuk > 20:
_____ if mangkuk > 40:
_____ _____ print("Mangkuk lebih dari 40")
_____ else:
_____ _____ print("Pelik sungguh mangkuk ni")
else:
_____ print("Aik kenapa dengan mangkuk ni?")
@
Pelik sungguh mangkuk ni
Select the correct output
@
mangkuk = 20
if mangkuk > 20:
_____ if mangkuk > 40:
_____ _____ print("Mangkuk lebih dari 40")
_____ else:
_____ _____ print("Pelik sungguh mangkuk ni")
else:
_____ print("Aik kenapa dengan mangkuk ni?")
@
Aik kenapa dengan mangkuk ni?