Write class called myset


Problem

Write class called mySet. Your class should have a single instance variable that is a list. Set elements will be stored in the list. Remember, sets do not allow duplicate elements. The initializer should allow a mySet object to be constructed from the following types of Python objects: list, str (individual characters are added to the set), tuple, dict (keys are added to the set). A mySet object can also be created from another mySet object. The following operations should be supported for a mySet object names set:

len(set)
x in set
x not in set
set 1 == set 2
set 1 != set 2
isdisjoint(otherset)
issubset(otherSet) #set <= otherSet
set < otherSet #proper subset
issuperset(otherSet) #set >= otherSet
set > otherSet #proper subset
union(otherSet) #set | otherSet
intersection(other) #set & other
difference(otherSet) #set - otherSet
symmetric_difference(otherSet) #set ^ otherSet
copy()
update(otherSet) #set |= otherSet
intersection_update(other) #set &= other
difference_update(other) #set -= other
symmetric_difference_update(other) #set ^= other
add(element)
remove(element)

discard(element)
pop() #Remove and return an arbitrary element from set. Raises KeyError if set is empty.
clear()

Write code in python please! Write class called mySet.

Request for Solution File

Ask an Expert for Answer!!
Python Programming: Write class called myset
Reference No:- TGS03212938

Expected delivery within 24 Hours