Question: Create a file named set.py with a class named Set that implements a class for representing a mathematical set (an unordered collection of distinct items).

 Create a file named set.py with a class named Set that

Create a file named set.py with a class named Set that implements a class for representing a mathematical set (an unordered collection of distinct items). Also implement a unit test file named test_Set.py that tests each of your methods. Note, with the except of the__init__and insert method, none of the other methods should mutate the set itself or any of the parameters. Implement methods named: insert - takes one parameter which is the item to insert into the set contains - takes one parameter and returns True or False indicating if the parameter is in the set isSubsetOf - takes one parameter that is a Set object and returns True if the set is a subset of the parameter set and false otherwise __len__ -returns the number of items in the set implement the method for the + operator that returns a now Set that is the union of the two sets implement the method for the - operator that returns a new Set which is the difference of the two sets (the items in the left set that are not in the right set.) implement the methods for the == and ! = methods that return True or False depending on the two sets and the corresponding operator Implement your Set using one instance variable - a list of the items that are in the set. Each method will use the methods/operators that lists have to implement the set method. Write appropriate documentation strings that describe what each Set method does

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!