B03C-2015 – Computer Sir Ki Class

Login


Lost your password?

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

Login
[lwa]



Exam Questions-CBSE12A-2015-B03C #PYTHON#6369    siteicon   siteicon  

Problem Statement - B03C-2015

Write PUSH (Names) and POP (Names) methods in python to add Names and Remove names considering them to act as Push and Pop operations of Stack.

Solution

TC++ #6369

def push(Name):
    Stack.append(Name)
    print ‘Element:',Name,'inserted successfully'

def pop():
    if Stack == []:
        print('Stack is empty!')
    else:
        print('Deleted element is',Stack.pop())


Share

CSKC| Created: 11-Jan-2019 | Updated: 11-Jan-2019|CBSE12A-2015









Back