Added the recursive solution in Python.