Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ListDeque:
- def __init__(self):
- self.__items = []
- def __size__(self):
- return len(self.__items)
- def is_empty(self):
- return self.__items == []
- def add_first(self, item):
- self.__items.insert(0, item)
- def add_last(self, item):
- self.__items.append(item)
- def get_first(self):
- return self.__items[0]
- def get_last(self):
- return self.__items[-1]
- def remove_first(self):
- return self.__items.pop(0)
- def remove_last(self):
- return self.__items.pop()
- def clear(self):
- return self.__items.clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement