20 lines
384 B
Python
20 lines
384 B
Python
|
class Queue:
|
||
|
def __init__(self):
|
||
|
self.items = []
|
||
|
|
||
|
def is_empty(self):
|
||
|
return len(self.items) == 0
|
||
|
|
||
|
def enqueue(self, item):
|
||
|
self.items.append(item)
|
||
|
|
||
|
def dequeue(self):
|
||
|
if not self.is_empty():
|
||
|
return self.items.pop(0)
|
||
|
|
||
|
def size(self):
|
||
|
return len(self.items)
|
||
|
|
||
|
def __str__(self):
|
||
|
return str(self.items)
|