How to calc the factorial of n depth k.. Help me please | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to calc the factorial of n depth k.. Help me please

"Def fact(n, k)" should return factorial n depth k # fact(6, 3) > (6 * 5 * 4) > 120

12th Dec 2016, 8:44 AM
Alexandr Kluev
Alexandr Kluev - avatar
2 Answers
+ 1
Thanks, but with n=4 k=3 return NOT 24 (4*3*2=24). I came up with. My version : i=1 p=1 c=n If k==1: return n while i<k: p=n*(c-i) n=p i+=1 return p
12th Dec 2016, 9:53 AM
Alexandr Kluev
Alexandr Kluev - avatar
0
Good morning, Nick :) . In any case, thanks for the help))
12th Dec 2016, 10:19 AM
Alexandr Kluev
Alexandr Kluev - avatar