LK_03_schusterje/queue.py

20 lines
384 B
Python
Raw Normal View History

2024-12-04 08:58:55 +01:00
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)