Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/queue.py Secret

Created Feb 17, 2021
Embed
What would you like to do?
class Queue():
def __init__(self):
self.size = 0
self.list = []
def enqueue(self, data):
self.list.append(data)
self.size += 1
def dequeue(self):
try:
self.size -= 1
return self.list.pop(0)
except Exception as error:
print(f'{error} is not possible')
def xprint(self, index):
print(self.list[index])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment