Python Tutorial

What is a Set in Python

What is a Python Set?

A set in Python is an unordered group or collection data type that is iterable, changeable, and free of duplicate components. In Python, the set class represents the mathematical idea of a set. 

The key advantage of using a set over a list is that it allows you to quickly determine if a particular member is in the set. A hash table is a sort of data structure that this is based on. Because sets aren't ordered like lists, we can't use indexes to get them.

Did you find this article helpful?