Generation

generate functionSun, 19 Feb 2023

Write a program to reverse a stack

def reverseStack(stack): if len(stack) == 0: return temp = stack.pop() print(temp) reverseStack(stack) stack.append(temp) s = [1,2,3,4,5] reverseStack(s) print(s)

Want to kickstart your project?Use the new AI Studio to create your code