Created
July 21, 2017 19:20
-
-
Save ggodreau/cd66877945af1aa7c27d81c3c3ac1177 to your computer and use it in GitHub Desktop.
Demo script for the pystack.py module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
sys.path.append('./pystack.py') | |
from pystack import Stack | |
# initialize Stack class object | |
myStack = Stack() | |
print "Initial stack (empty): ", myStack.show() | |
print "Pushing 2 onto stack..." | |
myStack.push(2) | |
print "show: ", myStack.show() | |
print "Pushing 1 onto stack..." | |
myStack.push(1) | |
print "show: ", myStack.show() | |
print "Pushing 4 onto stack..." | |
myStack.push(4) | |
print "show: ", myStack.show() | |
print "Popping 4 from stack..." | |
myStack.pop() | |
print "show: ", myStack.show() | |
print "Pushing 3 onto stack..." | |
myStack.push(3) | |
print "show: ", myStack.show() | |
print "Sorting stack..." | |
print "show: ", myStack.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment