Write AddClient(Client) and DeleteCleint(Client) methods in python to add a new Client and delete a Client from a List of Client Names, considering them to act as insert and delete operations of the queue data structure.
Solution
TC++ #6130
def AddClient(Client):
C=raw_input("Client name: ")
Client.append(C)
def DeleteClient(Client):
if (Client==[]):
print "Queue empty"
else:
print Client[0],"Deleted"
del Client[0] # OR Client.pop(0)
OR
class queue:
Client=[]
def AddClient(self):
a=raw_input("Client name: ")
queue.Client.append(a)
def DeleteClient(self):
if (queue.Client==[]):
print "Queue empty"
else:
print queue.Client[0],"Deleted"
del queue.Client[0]