How to Get Number of Items in a Set in Python


In this example we will show how to get the number of items in a set in Python.

Source Code

my_set = {'a', 'b', 1, 'c'}

print(len(my_set))

Output:

4
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments