List Comprehension Flashcards

1
Q

List Comprehension

A

Formulaic creation of a new list based on the values in an existing list

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

What does the zip function do?

A

Performs an element wise combination of sequences

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

Zip sample;
Variable = zip(list1, list2)

A

Out put will be a list of tuples combining the elements from both lists sequentially

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

What operator do you use to unzip

A

;
list1, list2 = zip(
zipped list or list of tuples)

print(list1)
print(list2)

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