-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmd_ds_prac5_2.py
27 lines (21 loc) · 952 Bytes
/
md_ds_prac5_2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#Aim : Program to demonstrate previously created Queue
from md_ds_prac5_1 import Queue
from time import *
def queueImplementation():
Q=Queue()
for i in range(1,11):
num=int(input("Enter Number:"))
Q.enqueue(num)
#Q.enqueue(i)
print("Queue Length:",len(Q))
for i in range(1,11):
if not(Q.isEmpty()):
t1=perf_counter()
num=int(Q.dequeue())
print(num,"Square=",num*num)
print(num,"Removed from Queue")
t2=perf_counter()
print("time take to process",num," is ",(t2-t1))
else:
print("Queue is Empty")
queueImplementation()