# Stack using a list
# Initialise an empty stack
stack = []

# Add an item to the stack
item = "apples"
stack.append(item)
print "Added item ",item
print "Stack is ",stack

# Add an item to the stack
item = "oranges"
stack.append(item)
print "Added item ",item
print "Stack is ",stack

# Retrieve an item from the stack
if len(stack) > 0:
    # At least one item in the stack
    item = stack.pop()
    print "Next item is ",item
    print "Stack is ",stack
else:
    # Stack is empty
    item = ""
    print "No item retrieved"
    print "Stack is empty"

# Retrieve an item from the stack
if len(stack) > 0:
    # At least one item in the stack
    item = stack.pop()
    print "Next item is ",item
    print "Stack is ",stack
else:
    # Stack is empty
    item = ""
    print "No item retrieved"
    print "Stack is empty"

# Retrieve an item from the stack
if len(stack) > 0:
    # At least one item in the stack
    item = stack.pop()
    print "Next item is ",item
    print "Stack is ",stack
else:
    # Stack is empty
    item = ""
    print "No item retrieved"
    print "Stack is empty"
