AI engineering glossary · Python core

What is set?

Set: An unordered, mutable collection of unique, hashable elements written in curly braces. It removes duplicates automatically and tests membership very fast. It supports union, intersection and difference operations. Sets are handy for removing duplicates and for fast membership tests on large data.

Level: beginnerTopic: Python core

Set: an example

set([1, 2, 2, 3]) gives {1, 2, 3}. {1, 2} | {2, 3} gives {1, 2, 3} and {1, 2} & {2, 3} gives {2}.

Related terms

More Python core terms

Where you learn it

Set is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.