#!/usr/bin/env pythonstack = []def pushit(): stack.append(raw_input('Enter New string:').strip())def popit(): if len(stack) == 0: print "Cannot pop from an empty stack!" else: r=stack.pop() print "Removed [ %s]" %rdef viewstatck(): print stackCMDs = {'u':pushit,'o':popit,'v':viewstatck}def showmenu(): pr=""" p(U)sh P(O)p (V)iew (Q)uit Enter choice:""" while True: choice = raw_input(pr).strip()[0].lower() print "\nYou picked:[%s]"%choice if choice == 'q': break if choice not in 'uovq': print 'Invalid option,tyr again' continue else: CMDs[choice]()if __name__ == '__main__': showmenu()