stack = [None for i in range(5)]
basePointer = 0
topPointer = -1
stackFull = 5
print(stack)
def push(word):
global topPointer, stackFull
if topPointer != stackFull-1:
stack[topPointer+1] = word
topPointer = topPointer + 1
else:
print('stack is full.')
def pop():
global topPointer
if topPointer != -1:
stack[topPointer] = None
topPointer = topPointer - 1
else:
print('stack is empty')
push('ic')
push('luna')
push('lily')
print(stack)
def Auto_Pop(k):
for i in range(k):
pop()
print(stack)
k = topPointer+1
Auto_Pop(k)
10. Add an interface function void STACKmultipop(int k) that pops k elements from the stack, or until the stack is empty.