Quiz: Python Tuples

Challenge your understanding of Python tuples with this quiz covering creation, immutability, indexing, unpacking, and more.

1.

Which of the following best describes a Python tuple?

2.

What will be the output of the following code?

python
1
2
thistuple = ("apple", "banana", "cherry")
print(len(thistuple))
3.

Which function is used to convert a list into a tuple?

4.

What will this code output?

python
1
2
3
fruits = ("apple", "banana", "cherry")
(green, yellow, red) = fruits
print(yellow)
5.

What will this code print?

python
1
2
fruits = ("apple", "banana", "cherry")
print("grape" in fruits)