Computer Science, asked by sona0007, 7 months ago

5. Write a python program to implement stack operations push and pop in stack.

Answers

Answered by allysia
2

Language:

Python

Program:  

#using functions cus they make it look clean and easy.

#Pushing element in stack.

def push(stack, element):

def push(stack,element):

   stack.append(element)

   return ([stack[i] for i in range(len(stack)-1,-1,-1)])  

#Popping value in:

def pop(stack):

   stack.pop()

   return stack  

Similar questions