B03C-2017 – Computer Sir Ki Class

Login


Lost your password?

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

Login
[lwa]



Exam Questions-CBSE12A-2017-B03C #PYTHON#6246    siteicon   siteicon  

Problem Statement - B03C-2017

Write Addnew(Member) and Remove(Member) methods in python to Add a new Member and Remove a Member from a List of Members, considering them to act as INSERT and DELETE operations of the data structure Queue.

Solution

TC++ #6246

class queue:
    Member=[]
    def Addnew(self):
        a=input("enter member name: ")
        queue.Member.append(a)
    def Remove(self):
        if (queue.Member==[]):
            print "Queue empty"
        else:
            print "deleted element is: ",queue.Member[0]
            del queue.Member[0] # queue.Member.delete()


Share

CSKC| Created: 10-Jan-2019 | Updated: 10-Jan-2019|CBSE12A-2017









Back