Python Control Structures Flashcards
Three types of control structure
*Sequential structure
*Decision/Selection structure
*Repetition structure / Iterative
It is a control structure built into Python.
Sequential structure
This refers to the control structure that utilizes the if/elif/else statements.
Decision/selection structure
It is a control structure also known as the while repetition or for repetition structure.
Repetition structure / Iterative
This refers to the control structure that with normal flow/sequential execution, as well as line by line/normal execution.
Sequential structure
In this control structure, there will be a condition and based on the condition then the control will flow in only one direction.
Decision/Selection structure
It allows us to execute a statement or group of statement multiple times.
Loop statement
These are used to change the flow of execution from its normal sequence.
Loop control statements
This statement repeats a statement or group of statements while a given condition is TRUE. It tests the condition before executing the loop body.
While loop
It executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.
For loop
It is used in case the need is to iterate over a specific number of times within a given range in steps/intervals mentioned.
Range function in loops
It terminates the loop statement and transfers execution to the statement immediately following the loop.
Break statement
It causes the loop to skip the remainder of its body and immediately retest its condition.
Continue statement
It is used when a statement is required syntactically but do not want any command or code to execute or if the code needs to be implemented in the future, behaving like a placeholder for future code.
Pass statement
It is used when a statement is required syntactically but do not want any command or code to execute or if the code needs to be implemented in the future, behaving like a placeholder for future code.
Pass statement