Linear Recursion In Python