+ 2
Can Anyone explain it please!
def factorial(x): if x == 1: return 1 else: return x * factorial(x-1) print(factorial(44)) https://code.sololearn.com/cimOkDECT11G/?ref=app
4 Respuestas
+ 4
I think this are similar to your question.
*Recursion
*Factorial
https://www.sololearn.com/discuss/1224178/?ref=app
https://www.sololearn.com/discuss/212338/?ref=app
https://www.sololearn.com/discuss/310479/?ref=app
https://www.sololearn.com/discuss/555402/?ref=app
+ 3
It‘s recursive calculation of factorial
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2465/
+ 3
thanks you all
+ 1
In shortcut:
44*fact(44-1 or 43)
44*43*fact(43-1 or 42)
44*43*42*fact(42-1)
...
44*43*...*2*fact(1)
44*43*...*2*1[since fact(1) returns 1]
It's a recursive function!