List Comprehension Flashcards
1
Q
List Comprehension
A
Formulaic creation of a new list based on the values in an existing list
2
Q
What does the zip function do?
A
Performs an element wise combination of sequences
3
Q
Zip sample;
Variable = zip(list1, list2)
A
Out put will be a list of tuples combining the elements from both lists sequentially
4
Q
What operator do you use to unzip
A
;
list1, list2 = zip(zipped list or list of tuples)
print(list1)
print(list2)