Lists & Tuples · Question 12 · Medium

For the tuple t = (1, 2, 3), which of these operations is NOT allowed?

  1. t + (4,)
  2. t[1:]
  3. t.count(2)
  4. t.append(4)
Answer and explanation

Answer: D. t.append(4)

Explanation: A tuple cannot be changed after creation, so it has no append() method. Concatenation and slicing build new tuples, and count() only reads the tuple, so all three are allowed.

Previous: A starred name is used while unpacking a list. What is printed? · Next: A marks table is stored as a list of rows. What does this print?

Practise lists & tuples

Try a fresh set of lists & tuples questions with an explanation after every answer, free and without signing up: Lists & Tuples practice. Or sit a full placement mock test.

More lists & tuples questions

More python practice

Dictionaries & Sets · Conditions & Loops · Functions & Scope · Comprehensions & Generators · Classes & Objects · Exceptions & Files · Built-ins & Standard Library · Variables, Types & Operators

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge