+ 1
How to use chain function
can any one help me with examples
1 Resposta
0
Like recursion?
Set a base case.
Let func(1) return 1
Then, define the func
func(x)=func(x-1)*x
So it goes like:
def func(x):
if x==1:return 1
else:return func(x-1)*x
It is an example of factorial using recursion