Q:

how to declare an empty set in python

# Distinguish set and dictionary while creating empty set

# initialize a with {}
a = {}

# check data type of a
print(type(a))

# initialize a with set()
a = set()

# check data type of a
print(type(a))
7
#Create a new empty set 
x = set()
print(x)
#Create a non empty set
n = set([0, 1, 2, 3, 4])
print(n)

2

New to Communities?

Join the community