Loops Flashcards
1
Q
break
A
In a loop, the break keyword escapes the loop, regardless of the iteration number. Once break executes, the program will continue to execute after the loop.
2
Q
continue
A
The continue statement gives you the option to skip over the part of a loop where an external condition is triggered, but to go on to complete the rest of the loop.
3
Q
List Comprehension
A
Python list comprehensions provide a concise way for creating lists.
[EXPRESSION for ITEM in LIST <if>].</if>
4
Q
[0 for num in range(3)]
A
[0, 0, 0]
5
Q
range()
A
The range() function can be used to create a list that can be used to specify the number of iterations in a for loop.
6
Q
A