B03C-2018 – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-CBSE12A-2018-B03C #PYTHON#6130    siteicon   siteicon  

Problem Statement - B03C-2018

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]


Share

CSKC| Created: 9-Jan-2019 | Updated: 9-Jan-2019|CBSE12A-2018









Back