Hi @historic66,

sorry for the late reply, I was a tad bit busy yesterday

Let us first look at an example of the solution which this exercise is supposed to lead us to produce:

```
def factorial(x):
return 1 if x < 2 else x * factorial(x-1)
print factorial(10)
```

You face the same problem as me in that we both thought that our code (such as the one written above) is utilising the in-built Python factorial function, and is hence a bogus exercise. Upon trawling through multiple threads, I realised that **this is in fact not the case**.

What this exercise aims for us to do is **not** to utilise the in-built factorial function, but rather, to understand how the calculation of factorial(n) works and then create a function to do this calculation. Although there is indeed already an in-built Python function that can be used for this purpose, forcing us to think of our own function using our knowledge of factorial is a far better way to train us as new programmers. Upon such noble intentions was the Python exercise in question established.

Let us then inspect why the proposed solution is not simply calling a built-in factorial function, but rather **constructing** a function that calculates factorials.

In the body of the function, we have this line:

```
return 1 if x < 2 else x * factorial(x-1)
```

What is happening here? As the moderator @ mtf so eloquently puts it, we effectively “build a return stack and solve the recursion by dumping the stack when a base case is reached”. What does this really mean? Again, I refer back to his teachings:

"The way a recursion works is by building a stack of return values. Let’s say we ask for factorial(5). x is 5 when we start the function. The recursion takes place when x is multiplied by the factorial of 1 less than x. Each return value is stored in a stack. A value times a return value. When the base case is reached, 1 is returned. Then we go back through the stack.

```
[[[[[1] * 2] * 3] * 4] * 5]
1! == 1
2! == 2
3! == 6
4! == 24
5! == 120
```

in reverse order. Each block is a return value. Bear in mind that without the base case, we might never get out of a recursive loop, hence the fatal runtime error when it runs out of registers in the stack."

Take a few moments to really understand what he was trying to get at (I did, when I first saw that post). In simpler, layman terms, whenever we are trying to find the factorial of a number, such as factorial(5), the suggested solution will cause result in 5 * factorial(4), and because we called the function factorial in this line, the function will rerun, but with factorial(4) this time to get 4 * factorial(3), and so on and so forth until x < 2, in which case 1 is directly returned, terminating this loop (recursion). After all the reruns of our function, the final calculation will become 5 * 4 * 3 * 2 * 1 or otherwise known as 5 * factorial(4) in the first run, 5 * 4 * factorial(3) by the second run, 5 * 4 * 3 * factorial(2) by the third run etc.

If it helps, I suggest that you try this exercise by pretending that you do not know an in-built Python factorial function exists (I did). How can you build a function that calculates factorial then?

Better still, try the exercise again by naming the function a different name (any function name minus the taboo ones will work). Let me give you an example:

```
def my_own_function(x):
return 1 if x < 2 else x * my_own_function(x-1)
```

You will realise that this function works perfectly well as well, simply because this exercise was **never** about calling the in-built factorial function.

Hope this helps you I had quite a headache over this some time back as well hahah