Types of Set:-
Set के दो प्रकार होते है:
-
Set
-
Frozenset
How to declare Python Set
-
Python Set को { } के बीच elements के साथ declare किया जाता है।
a = {1, 2, 3}
print(a) # {1, 2, 3}
print(type(a)) # <class ‘set’>
-
set() function का use करके भी Set को declare कर सकते हैं
a = set([1, 2, 3])
print(a) # {1, 2, 3}
print(type(a)) # <class ‘set’>
Types of Set:-
There are two types of sets:
-
Set
-
Frozenset
How to declare Python Set
-
Python Set is declared with elements between { }
a = {1, 2, 3}
print(a) # {1, 2, 3}
print(type(a)) # <class ‘set’>
-
Set can also be declared using set() function.
a = set([1, 2, 3])
print(a) # {1, 2, 3}
print(type(a)) # <class ‘set’>