Wednesday, July 8, 2015

[Using Lists as Stacks]



#! python
stack = [3, 4, 5]
stack.append(6)
stack.append(7)
print stack

x=stack.pop()
print "popped ",x
print stack

x=stack.pop()
print "popped ",x
x=stack.pop()
print "popped ",x
print stack

No comments:

Post a Comment