-
-
Save amankharwal/8650bd9b4810c30b641af24db219a16e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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