Dictionaries & Sets · Question 4 · Easy

Which expression creates an empty set?

  1. set()
  2. {}
  3. []
  4. ()
Answer and explanation

Answer: A. set()

Explanation: Empty braces {} create an empty dictionary, not a set, so the only way to write an empty set is set(). [] is an empty list and () is an empty tuple.

Previous: The same key is written twice in a dictionary literal. What is printed? · Next: A price is looked up with square brackets for an item that is not on the menu…

Practise dictionaries & sets

Try a fresh set of dictionaries & sets questions with an explanation after every answer, free and without signing up: Dictionaries & Sets practice. Or sit a full placement mock test.

More dictionaries & sets questions

More python practice

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

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