Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created February 17, 2021 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/8650bd9b4810c30b641af24db219a16e to your computer and use it in GitHub Desktop.
Save amankharwal/8650bd9b4810c30b641af24db219a16e to your computer and use it in GitHub Desktop.
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