Important Notice:

Course Content
Set Data Type in Python (Chapter-14) M3-R5
About Lesson

Types of Set:-         

           Set के दो प्रकार होते है:

  1. Set

  2. 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:

  1. Set

  2. 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’>

error: Content is protected !!