Set blog surya

PYTHON PROGRAMMING   SET 

SET:

Set are used to store multiple items in a single variable. sets are written with curly brackets.

EXAMPLE:

a={"apple","banana","cherry"}

print(a)

SET METHOD:

1.UNION()

       Return a set cotaining the union of sets.

EXAMPLE:


2.INTERSECTION()

            Return a set,that is the intersection of two or more sets.

EXAMPLE:

3.DIFFERENCE()

          Returns a set containing the difference between two or more sets.

EXAMPLE


4.CLEAR()

     Remove all the elementsfrom the set.

EXAMPLE


5.DIFFERENCE_UPDATE()

                     Remove the items in this set that are also included in another specified set.



6.INDERSECTION_UPDATE()

                   Remove the items in this set that are not present in other, specified sets.

EXAMPLE


7.ISDISJOINT()

           Returns whether two sets have a intersection or not.

EXAMPLE


8.ISSUPERSET()

           Returns whether this setcontains another set or not.

EXAMPLE


9.ISSUBSET()

            Return  whether another set cotains this set or not..

EXAMPLE

10.SYMMETRIC_DIFFERENCE()

              Returns a set with the symmetric differenceof two sets.

EXAMPLE


11.SYMMETRIC_DIFFERENCE_UPDATE()

                     Inserts the symmetric differences from this set and another.

EXAMPLE

    


 12.POP()

          Remove the specified  element.

EXAMPLE


13.UPDATE()

             Update  the set with another set ,or any other iterable.

EXAMPLE


14. REMOVE()

          Remove the specified element.

EXAMPLE



 










Comments

Popular posts from this blog

dictionary blog surya

PYTHON LIST