`n!`

is `n * (n-1) * (n-2) * (n-3)`

until the terms reach 1. E.g.:4! = 4 * 3 * 2 * 1 6! = 6 * 5 * 4 * 3 * 2 * 1In C# code (I refuse to write Python, it's a toy language)

C#

int Factorial(int n) { if (n <= 1) return 1; return n * (Factorial(n - 1); }The function Factorial calls itself to generate the sequence. Each time it is called, it is passed a parameter which is one lower than it was lasts time, until it reaches the end, when it returns 1 instead.

Returning 1 is the "base case", the rest is the "recursive case".

Try it on paper, and see what happens. It's pretty obvious when you get your head around it.