How to Create a Set in Python


In this example we will show how to create a set in Python.

Source Code

my_set = {'a', 'b', 1, 2, 'c'}
print(my_set)

Output:

{1, 2, 'c', 'a', 'b'}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments