Question: Consider the following class definition: class def Stack ( list ) : push ( self , item ) : self. append ( item ) What

Consider the following class definition:
class
def
Stack(list) :
push (self,
item) :
self. append (item)
What is the downside of this implementation approach?
Not all of the required Stack operations are defined.
It's unnecessary because Python has a built-in Stack data structure you can use.
You are exposing all list methods, not just the push (append) and pop.
It would have been better to inherit from a different built-in data structure.

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 Programming Questions!