Tuples and Sequences Flashcards
1
Q
How do you create a tuple?
A
(x,y,z)
2
Q
What’s the difference between a tuple and a list?
A
tuples are immutable and usually accessed by unpacking
3
Q
How to create an empty tuple?
A
()
4
Q
How to create a tuple with a single item?
A
(x,)
5
Q
How to unpack a tuple?
A
x,y,z = (12,34,54)