Question: banana verify Write a function called banana.verify, that takes 4 parameters: . A source word (str A goal word (str) . A container (Container) .

 banana verify Write a function called banana.verify, that takes 4 parameters:

banana verify Write a function called banana.verify, that takes 4 parameters: . A source word (str A goal word (str) . A container (Container) . A list of moves (ist of str) The source and goal words are the source and goal words for the banana game. The list of moves is a list of moves, with M meaning move, P meaning put, and G meaning get. So the CAT example from the exercise 2 handout would have the moves list: A Container is an ADT that has four methods: put (item) adds an item to the container, get ) removes and returns the next item in the container, peekO returns the value of the next item that will be returned by get but doesn't actually modify the container2, and is.emptyO returns True iff the container is empty. You won't know how the container object is implemented, and you shouldn't care. It could be a stack, or a queue, or a bucket, or something else entirely. Your job is to test whether the moves in the moves list preformed using the specified container will turn the source word into the goal word, in which case, your function will return True. Otherwise it should return False. Your code must start with the line: from container import we will provide the container class (you'll probably want to write your own for testing purposes), as well as the necessary exception classes if the container is full, as with a bucket, put will raise a ContainerFul1Exception if the container is empty, get and peek will raise a ContainerEmptyException

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!