Sets Assignment
Sets Assignment
i. Add (): ~ adds an element to the set only if it does not exist.
Code:
Output:
Code:
Output:
Code:
Output:
iv. Difference(): ~Returns a set containing the difference between
sets
Code:
Output:
Code:
Output:
Output:
viii. intersection(): ~ Returns a set containing common elements b/w sets
Code:
Output:
Code:
Output:
Code:
Output:
xi. issubset(): ~ Returns whether another set contains this set or not
Code:
Output:
xii. issuperset(): ~ Returns whether this set contains another set or not.
Code:
Output:
Code:
Output:
Code:
Output:
Code:
Output:
Code:
Output:
Code:
Output:
xviii. update(): ~ Updates the set with the union of this set and others
Code:
Output: