What is a set and when would you use one?

Python lists, dictionaries and sets · Freshers

Model answer

A set is an unordered collection of unique, hashable items. Use it to remove duplicates (set(items)), to test membership quickly (x in s), and for operations like union, intersection and difference.

Learn this topic

Dictionaries, Tuples and Sets in Python in the course Python for Beginners: Learn to Code with Real Projects.

Sign in to add your own answer.

More questions