Browse Source

Merge pull request #10 from dafinoer/queque_py

Added a queque
pull/11/head
Jeffery Russell 6 years ago
committed by GitHub
parent
commit
758f261270
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 0 deletions
  1. +3
    -0
      .gitignore
  2. +44
    -0
      sorting/queque.py

+ 3
- 0
.gitignore View File

@ -102,3 +102,6 @@ venv.bak/
# mypy # mypy
.mypy_cache/ .mypy_cache/
#texteditor
.vscode

+ 44
- 0
sorting/queque.py View File

@ -0,0 +1,44 @@
class Queque:
def __init__(self):
self.queque = []
def enqueue(self, data):
if data not in self.queque:
self.queque.append(data)
return True
return False
def dequeue(self):
if len(self.queque) > 0:
return self.queque.pop(0)
return ('Queque empty')
def sizeQueque(self):
return len(self.queque)
def printQueque(self):
return self.queque
if __name__ == '__main__':
myqueque = Queque()
data = myqueque.enqueue(5)
data = myqueque.enqueue(6)
data = myqueque.enqueue(7)
data = myqueque.enqueue(10)
print(myqueque.sizeQueque())
print(myqueque.printQueque())
dequeue = myqueque.dequeue() # delete 5
dequeue = myqueque.dequeue() # delete 6
print(myqueque.printQueque())
print(myqueque.sizeQueque())

Loading…
Cancel
Save