Tag sets

Python Sets

A set is a collection which is unordered and unindexed. In Python sets are written with curly brackets.

Example:

thisset = {“apple”, “banana”, “cherry”}

Access Items

You cannot access items in a set by referring to an index, since sets are unordered the items has no index.

But you can loop through the set items using a for loop, or ask if a specified value is present in a set, by using the in keyword.

Let’s explore Sets and Booleans concepts with Jupyter notebook.