28. Quiz: Tuples

Tuples

QUIZ QUESTION::

Match the following qualities to their data structure.

ANSWER CHOICES:



Data Structure

Quality

Tuples - are they ordered or unordered?

Tuples - are they mutable or immutable?

Lists - are they ordered or unordered?

Lists - are they mutable or immutable?

SOLUTION:

Data Structure

Quality

Tuples - are they ordered or unordered?

Lists - are they ordered or unordered?

Tuples - are they mutable or immutable?

Tuples - are they mutable or immutable?

Tuples - are they ordered or unordered?

Lists - are they ordered or unordered?

Lists - are they mutable or immutable?

Tuples

What would the output of the following code be? (Treat the comma in the multiple choice answers as newlines.)

tuple_a = 1, 2
tuple_b = (1, 2)

print(tuple_a == tuple_b)
print(tuple_a[1])
SOLUTION: True, 2

Tuples Playground

Start Quiz:

## You may test any code out here. Use Test Run to see your output