Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Queue(object):
- def __init__(self):
- """ Initialise empty Queue list."""
- self.li = []
- def insert(self,item):
- """ Add item to back of Queue."""
- self.li.append(item)
- def remove(self):
- """ Check if items in the Queue list.
- If True, remove the first item.
- Else, return 'empty queue.'"""
- if self.li:
- return self.li.pop(0)
- return 'empty queue'
- queue = Queue()
- queue.insert(5)
- queue.insert(6)
- print queue.remove()
- queue.insert(7)
- print queue.remove()
- print queue.remove()
- print queue.remove()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement