Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stack = []
- def push(x):
- print('ok')
- stack.append(x)
- def back():
- print( stack[-1] )
- def pop():
- back()
- stack.pop()
- def size():
- print( len(stack) )
- def clear():
- print('ok')
- stack.clear()
- while True:
- command = input()
- if command == 'exit':
- print('bye')
- break
- elif command[:4] == 'push':
- push(command.split()[1])
- else:
- exec( command + "()" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement