M03 - Tuples Flashcards

1
Q

Tuples

A
  • Similar to lists, but cannot be changed

- This means tuples are immutable: we cannot add or remove items from them

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

Create empty tuple syntax

A

tuple_variable = ( )
or
tuple_variable = tuple( )

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

Tuple syntax

A

tuple_variable = (‘Item1’ , ‘Item2’ , ‘Item3’ , etc.)

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

Get tuple length syntax

A

len(tuple_variable)

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

Tuples and indexing/slicing

A

Just like w/ lists:

tuple_variable[index]

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