Tuples and Sequences Flashcards

1
Q

How do you create a tuple?

A

(x,y,z)

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

What’s the difference between a tuple and a list?

A

tuples are immutable and usually accessed by unpacking

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

How to create an empty tuple?

A

()

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

How to create a tuple with a single item?

A

(x,)

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

How to unpack a tuple?

A

x,y,z = (12,34,54)

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