The concept behind stacks can be learnt from the following video tutorial

A program that implements Stacks is as follows:

#class for defining a stack
class Stack:
    def __init__(self):
        self.items = []
    #method for pushing an item on a stack
    def push(self,item):
    #method for popping an item from a stack
    def pop(self):
        return self.items.pop()
    #method to check whether the stack is empty or not
    def isEmpty(self):
        return (self.items == [])
    #method to get the top of the stack
    def topOfStack(self):
        return len(self.items)
    def __str__(self):
        return str(self.items)

stck = Stack()


print stck
#Output = [5, 10, 15, 20]


print stck
#Output = [5, 10, 15]

print stck.topOfStack()
#Output = 3


Some Very Useful Machine Learning Tutorials available in the Web

Following tutorials are really good machine learning tutorials available in the web. If someone doesn’t wants to enroll in a class at various online courses offered for free (coursera, etc) then one can certainly learn machine learning from the following tutorials:

1. Machine Learning Course taught by Tom Mitchell at Carnegie Mellon.

2. Machine Learning Course taught by Andrew Ng at Stanford.

If one is interested to learn machine learning using Python then the following are certainly good sources:

1. scikit-learn