Assume the following class implements the STACK abstract data type…

Question Answered step-by-step Assume the following class implements the STACK abstract data type… Assume the following class implements the STACK abstract data type (ADT) using the array ADT.class aStack(iArray):    def __init__(self, capacity = 5):        self._items = iArray(capacity)        self._top = -1        self._size = 0     def push(self, newItem):        self._top += 1        self._size += 1        self._items[self._top] = newItem    def pop(self):        oldItem = self._items[self._top]        self._items[self._top] = None        self._top -= 1        self._size -= 1        return oldItem    def peek(self):        return self._items[self._top]    def __len__(self):        return self._size    def __str__(self):        result = ‘ ‘        for i in range(len(self)):            result += str(self._items[i]) + ‘ ‘        return result a) [10 pts] Emulate the stack behavior using the Python list data structure rather than the Arrary ADT. [ ]   1#INSERT YOUR ANSWER HERE.    b) [15 pts] Redefine the Stack class methods to push and pop two items rather than one item at a time.For example, if the stack includes numbers from one to ten: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], then invoking the pop() method twice will remove the last four elements and modify the stack elements to be: [1, 2, 3, 4, 5, 6] [ ] 1 #INSERT YOUR ANSWER HERE.        c) [15 pts] Define and implement a function that reverses the items of a given stack using only the methods defined in the Stack class.For example, if the stack includes the elements from one to ten: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], then calling the new function will modify the stack elements to be from ten to one: [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] [ ] 1 #INSERT YOUR ANSWER HERE.     Computer Science Engineering & Technology Python Programming CIND 830 Share QuestionEmailCopy link Comments (0)