Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Queue:
- def __init__(self,size = 100):
- #@param size: int
- self.queue = []
- self.size = size
- def In(self,element):
- #@param element: qualsiasi tipo
- if len(self.queue) <= self.size:
- self.queue.append(element)
- else:
- print('Raggiunto limite di memoria')
- def Out(self):
- self.queue = self.queue[1:]
- def first(self):
- #@return: qualsiasi tipo
- return self.queue[0]
- def last(self):
- #@return: qualsiasi tipo
- return self.queue[-1]
- def empty(self):
- #@return: bool
- return not self.queue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement