1/20
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Control Structures
is a block of statements that analyzes variables and chooses a direction in which to go based on a given parameter.
Sequence Control Structures
is a line-by-line execution of statements sequentially in the same order in which they appear in the script.
Decision Control Structures
is a control structure that depends on whether a condition is true or false.
Decision Control Structures
This structure may skip the execution of an entire block of statements or even execute one block of statements instead of another.
Loop Control Structures
is a structure that allows the execution of a block of statements multiple times until a specified condition is met.
if statement
in Python, it is used to implement a decision
Simple Decision
has a form of:
if <condition>:
body
Two-way Decision / if-else statement
has the form of:
if <condition>:
statements
else:
statements
multi-way decision
structure in programming is a structure wherein a decision is nested inside another decision.
multi-way decision
It has the form of:
if <condition1>:
<case1 statements>
elif <condition2>:
<case2 statements>
elif <condition3>:
<case3 statements>
. . .
else:
<default statements>
Definite Loops
It is a type of loop where the number of iterations/repetitions is known before the start of the execution of the body of the loop.
Definite Loops
It is implemented by using count-controlled loops.
Indefinite Loops
It is a type of loop where the number of iterations/repetitions is not known before the start of the execution of the body of the loop.
Indefinite Loops
It is implemented by using condition-controlled loops.
loop index
is a variable that is used to control a loop.
range function
it will produce a sequence of numbers that starts with 0 and goes up to, but does not include, the value of <expr>.
range (start,n)
This function produces a sequence that starts with the value start and continues up to, but does not include n.
range (start, n, step)
This function is like the two-parameter version, except that it uses step as the increment between numbers.
accumulator pattern
is a common programming pattern in which a final answer is built a piece at a time in a loop.
while statement
In Python, an indefinite loop is implemented using a __________
while statement
has this form:
while <condition>:
<body>