Loops Flashcards
For Loop
A loop control structure that runs a block of code a predetermined number of times.
While loop?
A loop control structure that runs a block of code until a certain logical expression is satisfied.
Range(1,11)
Incluye el primer número del rango, pero excluye el último. En este caso: 1,2,3,4,5,6,7,8,9,10
range(5)
0,1,2,3,4
range(0,5)
0,1,2,3,4
range (0,10,2)
0,2,4,6,8
range(10,1,-1)
10,9,8,7,6,5,4,3,2
for-each loops
Skip over the indices: you don’t have manually pull the values out, but you don’t have access to the indices either.
For-Each Loop
A loop control structure that runs a block of code a predetermined number of times, where number of times comes for the length of some lists and the items in the list are automatically loaded onto a variable for usage in the block code.
range(-5)
No answer