Oct-10-2020, 04:43 AM
I wouldn't use recursion for this particular problem as a list comprehension is easier to understand. Recursion is a good fit for problems that can be expressed in terms of smaller and smaller versions of the same problem, until you get to one that can be solved directly (the so called base case). That's precisely why computing n! is one example that's typically used.