PY-03-P1 Loops Flashcards
What are Loops?
Loops are blocks of code that run as long as the condition is true
A __ loop provides iterating capabilities
for loop
A ___ range, defined by r___( ) is also capable of iteration
set range, range( )
The ___ function returns the number of items of an object
len( )
The r___( ) function accepts an integer and returns the range of the object
range( )
If a condition is false, the ___ loop will not be executed
while loops
The ____ command exits a loop
break
Behaves as if the code reached the end of the block
continue command
the _____ command skips an iteration
continue command
____ statements are used as empty executions
pass statements
A loop becomes ____ if a condition is never False
Infinite Loops
the ____ function can be used to define a list within another list
append( )
adds a value to an existing variable
append( )
N __ lists can be used to arrange data in hierarchical structiures
nested
constructs an integer number casted from a string or float
int( )
Constructs a floating number from an integer or float
float( )
Constructs a string from a wide variety of data types
str( )
How are conditions executed?
by if and else commands
Multiple if statements can be chained together using the ____ command
elif
using the ____ command helps make the code more efficient
elif
a ___ structure is a method of organizing and storing data so it can be accessed and acted upon easily
data structure
Data structures in Python include ___, _____ and lit
dictionary, tuple
A versatile and dynamic data type. Can hold different types of data simultaneously. The values are numerically indexed starting at 0
List
A list’s indexes are used for
List manipulation