-
Notifications
You must be signed in to change notification settings - Fork 0
/
13Queue_insert_del.py
72 lines (36 loc) · 929 Bytes
/
13Queue_insert_del.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# queue is a linear data structure,
#stores items in First In First Out (FIFO) manner
# QUEUE
def queue_enqueue():
r=int(input("ENTER YOUR ROLL NUMBER = "))
name=input(" ENTER YOUR NAME = ")
c= (r, name)
a.append(c)
def queue_dequeue():
if(a==[]):
print("QUEUE IS EMPTY")
else:
print("DELETED DATA IS: ",a.pop(0))
def queue_display():
if (a==[]):
print("QUEUE IS EMPTY")
for i in range(0, len(a)):
print(a[i])
#main program
a=[]
c = 'y'
while(c == 'y' or c == 'Y'):
print("1. ENQUEUE ")
print("2. DEQUEUE")
print("3. DISPLAY")
ch=int(input("ENTER YOUR CHOICE = "))
if(ch==1):
queue_enqueue()
elif(ch==2):
queue_dequeue()
elif(ch==3):
queue_display()
else:
print(" WRONG CHOICE!!!!1")
c=input("DO YOU WANT TO PROCEED 'Y' OR 'N = ")
print('Program Exit')