class Element: def __init__(self, data, prev, next): self.data = data self.prev = prev self.next = next class Queue2: def __init__(self): self.butt = None self.head = None def isEmpty(self): if self.butt is None and self.head is None: return True else: return False def showQueue(self): print(f"QUEUE head: {self.head}, butt: {self.butt}") current = self.head while current is not None: print(f"Data: {current.data}") current = current.next print("----") def enqueue(self, data): newElement = Element(data, self.butt, None) self.butt = newElement if self.head is None: self.head = newElement else: current = self.head while current.next is not None: current = current.next current.next = newElement def dequeue(self): if self.head is not None: ausgabe = self.head self.head = self.head.next if self.head is None: self.butt = None return ausgabe