Question: *PYTHON PROGRAM* Create a class called UniqueList that adheres to the following specifications: The class contains a single instance variable which represents a list. The
*PYTHON PROGRAM*
Create a class called UniqueList that adheres to the following specifications:
The class contains a single instance variable which represents a list.
The constructor receives no input and initializes the instance variable to be an empty list Items can be added to the list only through a method called addList whose only input is the item to be added to the list.
The addList method should only add the input item if it is not already in the list.
No error need be reported if the item to be added was already in the list. Items can be removed from the list only through a method called remList whose only input is the item to be removed from the list. The remList method should only remove the input item if it is in the list.
No error should be reported if the item to be removed was not in the list.
To print the list from outsided the class, provide an __str__ method that returns the list as a string.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
