class intset(object)"""an intset is set of integers""#information about the implementation (not the abstraction#the value of the set is represented by list of intsself vals #each int in the set occurs in self vals exactly once def __init__(self)"""create an empty set of integers""self vals [def insert(selfe)"""assumes is an integer and inserts into self""if not in self valsself vals append(edef member(selfe)"""assumes is an integer returns true if is in selfand false otherwise""return in self vals def remove(selfe)"""assumes is an integer and removes from self raises valueerror if is not in self""tryself vals remove(eexceptraise valueerror(str(enot found'def getmembers(self)"""returns list containing the elements of self nothing can be assumed about the order of the elements""return self vals[:def __str__(self)"""returns string representation of self""self vals sort(result 'for in self valsresult result str( ',return '{result[:- '}#- omits trailing comma figure class intset when function definition occurs within class definitionthe defined function is called method and is associated with the class these methods are sometimes referred to as method attributes of the class if this seems confusing at the momentdon' worry about it we will have lots more to say about this topic later in this classes support two kinds of operationsinstantiation is used to create instances of the class for examplethe statement intset(creates new object of type intset this object is called an instance of intset attribute references use dot notation to access attributes associated with the class for examples member refers to the method member associated with the instance of type intset