Skip to content

Instantly share code, notes, and snippets.

Created August 29, 2015 17:38
What would you like to do?
n = int(raw_input())
stack = []
def push(element):
return element
def pop():
if len(stack) == 0:
print "EMPTY"
return 0
return stack.pop()
def inc(count, inc_by):
if len(stack) == 0:
print "EMPTY"
return 0
for k in range(0, count):
stack[k] = stack[k] + inc_by
return 0
for i in range(n):
x = raw_input()
if x == 'push':
print "enter an element to push"
e = int(raw_input())
if x == 'pop':
if x == 'inc':
print "Enter the no.of elements to be incremented and by how much with (eg: 1 4)"
count, inc_by = raw_input().split()
count = int(count)
inc_by = int(inc_by)
inc(count, inc_by)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment