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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

List Comprehension

A

Python list comprehensions provide a concise way for creating lists.

[EXPRESSION for ITEM in LIST <if>].</if>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

[0 for num in range(3)]

A

[0, 0, 0]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly