Recursive Approach In Python