Lists & Tuples · Question 3 · Easy

Which expression creates a tuple containing the single element 7?

  1. (7)
  2. (7,)
  3. [7]
  4. tuple(7)
Answer and explanation

Answer: B. (7,)

Explanation: The comma makes the tuple, not the brackets, so (7,) is a one-element tuple. (7) is just the integer 7, [7] is a list, and tuple(7) raises TypeError because an integer is not iterable.

Previous: One value is appended and another inserted at the front of a list. What is… · Next: Three facts about a tuple of scores are printed. What is the output?

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