Question: The file m 2 6 9 _ tyre _ shop - py implements the tyre shop dictionary as a class, TyreShop, and adds the following
The file mtyreshoppy implements the tyre shop dictionary as a class, TyreShop, and adds the following methods: addstack to add a given stack name to the dictionary addtyre to add a given tyre diameter to a given stack name if possible and return success or failure removetyre to remove the top tyre from a given stack name, returning the diameter of the tyre removed checktyre to return the diameter of the top tyre of the stack with the given stack, without removing it from the stack isempty to return a Boolean indicating whether a stack is empty or not toptyres returns a dictionary of stack names mapped to the top tyre diameters get stackheight returns an integer height of a given stack name show a helper method to print out a visible representation of the stacks. This may help you in debugging!Jo is now considering the process of searching for exisiting tyres in the stacks.As Jo always tries to put tyres on the most suitable stack, they assume that the tyre they are searching for is most likely to be in the stacks with the closest diameter top tyre, as long as that diameter is either equal to or smaller than the tyre being searched for.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
