+2 votes
in Class 12 by kratos

Write a function in Python, INSERTQ(Arr,data) and DELETEQ(Arr) for performing insertion and deletion operations in a Queue. Arr is the list used for implementing queue and data is the value to be inserted.

1 Answer

+4 votes
by kratos
 
Best answer

def INSERTQ(Arr):

data=int(input("enter data to be inserted: "))

Arr.append(data)

def DELETEQ(Arr):

if (Arr==[]):

print( "Queue empty")

else:

print ("Deleted element is: ",Arr[0])

del(Arr[0])

...