Skip to content

Instantly share code, notes, and snippets.

@LPMatrix
Created April 11, 2021 18:20
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 LPMatrix/87c3db11de7172f77f321e540fbebfd9 to your computer and use it in GitHub Desktop.
Save LPMatrix/87c3db11de7172f77f321e540fbebfd9 to your computer and use it in GitHub Desktop.
class Queue:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def enqueue(self, item):
self.items.insert(0,item)
def dequeue(self):
return self.items.pop()
def size(self):
return len(self.items)
q=Queue()
q.enqueue(4)
q.enqueue('dog')
q.enqueue(True)
print(q.size())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment