Sets

Understand the variations of sets in Python.

This lesson lists different implementations of a set provided by Python 3 and explains when to use which built-in support.

Introduction

A set is a collection of items that does not allow duplicates. It’s an unordered collection.

⚠️ Note: In case you forget, the expression of a set involves curly-braces {} in Python. To create an empty set, we call the set() function. Using {} without any values in it will create a dictionary, not a set.

Types of sets

Mutable set with set

The set() ...

Access this course and 1400+ top-rated courses and projects.