Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def convert_collection_to_queue(_collection):
- return Queue(*_collection.values()) if isinstance(_collection, dict) else Queue(*_collection)
- class Queue:
- def __init__(self, *args):
- self._collection = list(args) if len(args) else []
- def push(self, item):
- self._collection.append(item)
- def pop(self):
- return self._collection.pop(0) if len(self._collection) else None
- def get_queue_as_list(self):
- return self._collection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement