S.A.P Chapter 6

5.0(2)
studied byStudied by 167 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/26

flashcard set

Earn XP

Description and Tags

Structured Algorithm and Programming Chapter 6 For Foundation Students September 2023 Intake Chapter 6 = Selection (Python)

Last updated 1:01 PM on 11/26/23
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

27 Terms

1
New cards

What does Control Structure Do in a Python

Control the flow of execution in a program.

2
New cards

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

3
New cards

Control Structures

How many Control Structures that we learn?

3

4
New cards

######################################################################

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

5
New cards

Relational Operators

Python supports the usual logical conditions from mathematics.

What is the most common way of using relational operators?

‘if statement’

loop

6
New cards

Relational Operators

Python supports the usual logical conditions from mathematics.

What is the other name for “Relational Operator”?

Comparison Operator

7
New cards

Relational Operators

What are the examples of Logical Operator?

and, or, not

8
New cards

Relational Operators

Python supports the usual logical conditions from mathematics.

@

Equals: _______________

@

Choose the correct example of the symbol.

a == b

9
New cards

Relational Operators

Python supports the usual logical conditions from mathematics.

@

Not Equals: _______________

@

Choose the correct example of the symbol.

a != b

10
New cards

Relational Operators

Python supports the usual logical conditions from mathematics.

@

Less than: _______________

@

Choose the correct example of the symbol.

a < b

11
New cards

Relational Operators

Python supports the usual logical conditions from mathematics.

@

Less than or equal to: _______________

@

Choose the correct example of the symbol.

a <= b

12
New cards

Relational Operators

Python supports the usual logical conditions from mathematics.

@

Greater than: _______________

@

Choose the correct example of the symbol.

a > b

13
New cards

Relational Operators

Python supports the usual logical conditions from mathematics.

@

Greater than or equal to: _______________

@

Choose the correct example of the symbol.

a >= b

14
New cards

######################################################################

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

15
New cards

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

16
New cards

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

17
New cards

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

18
New cards

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

19
New cards

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

20
New cards

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

21
New cards

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

22
New cards

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

23
New cards

What is a nested if?

A condition when you have ‘if statement’ inside another ‘if statement’

24
New cards

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")

25
New cards

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

26
New cards

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

27
New cards

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?

Explore top notes

note
3.3: Criminal behaviours
Updated 243d ago
0.0(0)
note
week 1
Updated 754d ago
0.0(0)
note
Intro to Ecology
Updated 1296d ago
0.0(0)
note
EM Waves and their Uses
Updated 1238d ago
0.0(0)
note
Unit 6: Period 6: 1865–1898
Updated 57d ago
0.0(0)
note
3.3: Criminal behaviours
Updated 243d ago
0.0(0)
note
week 1
Updated 754d ago
0.0(0)
note
Intro to Ecology
Updated 1296d ago
0.0(0)
note
EM Waves and their Uses
Updated 1238d ago
0.0(0)
note
Unit 6: Period 6: 1865–1898
Updated 57d ago
0.0(0)

Explore top flashcards

flashcards
WHAP Unit 1
26
Updated 324d ago
0.0(0)
flashcards
pharmacology
70
Updated 1084d ago
0.0(0)
flashcards
World History Chapter 24
40
Updated 1070d ago
0.0(0)
flashcards
Ch 2 Gov
26
Updated 1150d ago
0.0(0)
flashcards
Musculo-skeletal
30
Updated 1049d ago
0.0(0)
flashcards
WHAP Unit 1
26
Updated 324d ago
0.0(0)
flashcards
pharmacology
70
Updated 1084d ago
0.0(0)
flashcards
World History Chapter 24
40
Updated 1070d ago
0.0(0)
flashcards
Ch 2 Gov
26
Updated 1150d ago
0.0(0)
flashcards
Musculo-skeletal
30
Updated 1049d ago
0.0(0)