How to use chain function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to use chain function

can any one help me with examples

11th Aug 2017, 5:41 AM
rama midhilesh bonadham
rama midhilesh bonadham - avatar
1 Answer
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
16th Sep 2017, 12:57 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar