Computer Science, asked by lalitkc3108, 8 months ago

implement a program from stack that performs the following operations using array 1.push 2.pop 3.peep 4.change 5.display

Answers

Answered by GamerAzim
1

Answer:

assuming it is python 3 or above program

Explanation:

class Stack:

    def __init__(self):

        self.items = []

    def isEmpty(self):

        return self.items == []

    def push(self, item):

        self.items.append(item)

    def pop(self):

        return self.items.pop()

    def peep(self):

        return self.items[len(self.items)-1]

    def display(self):

        return self.items

       

Similar questions