Question: Need help with Intro to Computer Science 2 (Python) problem: 3. Write a class Collection that represents a collection of items. The class supports six

Need help with Intro to Computer Science 2 (Python) problem:

Need help with Intro to Computer Science 2 (Python) problem: 3. Write

a class Collection that represents a collection of items. The class supports

3. Write a class Collection that represents a collection of items. The class supports six methods: init 0 which takes an optional parameter representing the maximum size of the collection. It sets the maximum size of the collection to the provided value or to the value 10 if no number is given as a parameter. It also creates an empty list to store the items in the collection. contains 0 which takes an item as a parameter and returns True if the item is already in the collection and False otherwise. The function must return a Boolean and not a string c. add which adds a new item to the collection. It does this by first checking that the maximum capacity for the collection hasn't been reached. If the maximum capacity has been reached, then the method returns False without modifying the collection. If the maximum capacity has not yet been reached, the method checks that the item is not already in the collection using the

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!