From 677ad7c4c845923524b1558bcf29ee33e8d119d9 Mon Sep 17 00:00:00 2001 From: shubham2751 <48217061+shubham2751@users.noreply.github.com> Date: Thu, 1 Oct 2020 10:32:57 +0530 Subject: [PATCH] Added test operations to an queue --- lists/queue.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/lists/queue.py b/lists/queue.py index e6883f1..3843a2d 100644 --- a/lists/queue.py +++ b/lists/queue.py @@ -22,3 +22,42 @@ def dequeue(self): def size(self): return len(self.items) + + def printEle(self): + return self.items + + +q = Queue() + +while True: + + print("1. Enqueue \n 2. Dequeue \n 3. checkLength \n 4. Print \n 5.EXIT") + + num = int(input("Enter the operation on queue :")) + + if num == 1: + + data = int(input("Enter DATA :")) + + q.enqueue(data) + + print("ADDED SUCCESSFULLY") + + elif num == 2: + + print(q.dequeue()) + + elif num == 3: + + print(q.__str__()) + + elif num == 4: + + l = q.printEle() + print(*l) + + elif num == 5: + break + + else: + print("Invalid Operation")