Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #!/usr/bin/python
  2. import sys
  3. sys.path.append('./pystack.py')
  4. from pystack import Stack
  5.  
  6. # initialize Stack class object
  7. myStack = Stack()
  8.  
  9. print "Initial stack (empty): ", myStack.show()
  10.  
  11. print "Pushing 2 onto stack..."
  12. myStack.push(2)
  13. print "show: ", myStack.show()
  14.  
  15. print "Pushing 1 onto stack..."
  16. myStack.push(1)
  17. print "show: ", myStack.show()
  18.  
  19. print "Pushing 4 onto stack..."
  20. myStack.push(4)
  21. print "show: ", myStack.show()
  22.  
  23. print "Popping 4 from stack..."
  24. myStack.pop()
  25. print "show: ", myStack.show()
  26.  
  27. print "Pushing 3 onto stack..."
  28. myStack.push(3)
  29. print "show: ", myStack.show()
  30.  
  31. print "Sorting stack..."
  32. print "show: ", myStack.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement