Use the set() function without any arguments to create an empty set in python. Don’t use empty curly braces ” {} ” otherwise it will get an empty dictionary.
Example empty set in Python
Simple example code. An empty set does not contain any elements.
empty_set = set()
print(empty_set)
print(type(empty_set))
Output: will appear as a “ <class ‘set’> ”.
![Empty set in Python](https://i0.wp.com/tutorial.eyehunts.com/wp-content/uploads/2021/10/Empty-set-in-Python.jpg?resize=270%2C142&ssl=1)
Do comment if you have any doubts or suggestions on this Python set basic tutorial.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
Windows 10
Python 3.10.1
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.