Python Sets Quiz

  • Questions: 15
  • Easy
  • Pass mark: 70%

A set keeps each item only once and in no particular order: the moons a probe has already photographed, the tools a rover carries, the planets two missions have visited. That makes sets the quickest way to check whether something is there, to drop duplicates and to compare two groups. This free quiz has 15 short questions on creating and changing sets in Python, on set operations, and on the mistakes beginners make most often with them.

What the quiz covers

  • Creating sets, the empty set, and why sets have no positions
  • Adding and removing items: add(), update(), remove() and discard()
  • Union, intersection, difference and symmetric difference, with operators and with methods
  • Comparing sets and checking subsets
  • What can go in a set, frozenset, set comprehensions and sorting the items of a set

How it works

  • 15 questions: 11 with one correct answer, 4 where you select every correct answer
  • After each question you see the correct answer and a short explanation
  • No time limit and no account needed
  • Score 70% or more (11 of 15) to pass

Each topic has a runnable example: creating sets, set operations, mathematical set operations and comparing sets. After this one, try the Python Tuples Quiz or the Python Dictionaries Quiz.