Learnmonkey Learnmonkey Logo
× Warning:

The tutorial you are reading is currently a work in-progress.

Python Sets

What is a Set?

A set is an unordered collection of things. Just like with lists and tuples, elements can be anything, but there is no order. Once you create an element, you can't change it, but you can still create and remove elements.

Making a Set

To make a set, we use curly braces ({ and }) and put the elements inside, seperated by brackets:

my_set = {"Alabama", 5, False, 2.3, 1003, "Toronto"}