0% found this document useful (0 votes)
5 views1 page

Stack Program A4-3

The document outlines a simple implementation of a stack using a list in Python. It demonstrates pushing elements 'x', 'y', and 'z' onto the stack and then popping them off one by one. After all elements are popped, the stack is empty.

Uploaded by

ppavan2835
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Stack Program A4-3

The document outlines a simple implementation of a stack using a list in Python. It demonstrates pushing elements 'x', 'y', and 'z' onto the stack and then popping them off one by one. After all elements are popped, the stack is empty.

Uploaded by

ppavan2835
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

# Initial empty stack

stack = []

# Pushing elements into stack


print("Initially stack is empty:", stack)

[Link]('x')
[Link]('y')
[Link]('z')

print("After PUSHING stack is:")


print(stack)

# Popping elements from stack


print("After POPPED from stack:")
print([Link]())
print([Link]())
print([Link]())

print("<br/>Stack after elements are popped:")


print(stack)

You might also like