Advertisement
Guest User

Stack usage

a guest
Sep 30th, 2015
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. from Stack2 import Stack
  2.  
  3. stack = Stack()
  4.  
  5. stack.push("an item")
  6.  
  7. print(stack.view()) # That will return the top value, edits made on it will not change data.
  8.  
  9. stack.change(stack.view() + " of any type")
  10.  
  11. print(stack.view) # Try to guess what this does :P
  12.  
  13. stack.pop() # Removes top item
  14.  
  15. if stack.isEmpty is True:
  16.     print("Stack is empty") # Prints "Stack is empty" if the stack is empty
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement