Guest User

Untitled

a guest
Jan 20th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. import util
  2.  
  3. def something():
  4.     stack = util.Stack
  5.     return stack.list
  6.  
  7.  
  8. class Stack:
  9.     "A container with a last-in-first-out (LIFO) queuing policy."
  10.     def __init__(self):
  11.         self.list = []
  12.  
  13.     def push(self,item):
  14.         "Push 'item' onto the stack"
  15.         self.list.append(item)
  16.  
  17.     def pop(self):
  18.         "Pop the most recently pushed item from the stack"
  19.         return self.list.pop()
  20.  
  21.     def isEmpty(self):
  22.         "Returns true if the stack is empty"
  23.         return len(self.list) == 0
Add Comment
Please, Sign In to add comment