1# Distinguish set and dictionary while creating empty set
2
3# initialize a with {}
4a = {}
5
6# check data type of a
7print(type(a))
8
9# initialize a with set()
10a = set()
11
12# check data type of a
13print(type(a))
1The simplest way to create set is:
21. from list
3code:
4 s = [1,2,3]
5 set = set(s)
6 print(set)
7
82. s,add() method
9code:
10 set.add(1)
11 set.add(2)
12 set.remove(2)
13 print(set) // 1
14
153. Set conatins unique elements