CPE Flashcards
It is the most important aspect of almost all of the programming language. It also allows us to run a block of code.
Decision Making
It is a statement used to test a specific condition
If-statement
It is a statement that is same as the if-statement but this also provides the false case
if-else statement
It is used to declare a block and also the most used part of python language
indentation
this statement catches what isn’t caught by the preceding conditions
else statement
“If the previous conditions were not true, then try this condition” statement
elif statement
T or F
The flow of the programs written in any programming language is sequential by default
True
This is also called as pre-tested loop
while loop
We use this type of loop if we do not know the number of iterations in advance
while loop
This is also called as per-tested loop
for loop
We use this type of loop when there’s a need to execute some part until given conditions is satisfied
for loop
It is best to use it if the number of iterations is known in advance
for loop
This is also called as post-tested loop
do-while loop
This type of loop continues until a given condition is satisfied
do-while loop
This changes the execution from its normal sequence
Loop Control Statements
With this statement, we can stop the loop even if the while condition is true
break
With this statement, we can stop the current iteration and proceed with the next one
continue
This statement runs a block of code once the condition is no longer true
Else
This generate a sequence of numbers
range() function
range(x,y,z) - identify the x,y,z’s purpose
x - start
y - stop
z - step size
A type of collection that is ordered, changeable, and allows duplicate members
List
A type of collection that is ordered, unchangeable, and allows duplicate members
Tuple
A type of collection that is Unordered, Unindexed, and no duplicate members
Set