Skip to content

Empty set in Python | Example code

  • by

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()


Output: will appear as a “ <class ‘set’> ”.

Empty set in Python

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.

Leave a Reply

Your email address will not be published. Required fields are marked *