def factorial(x): if x == 1: return 1 else: return x * factorial(x-1) print(factorial(5)) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

def factorial(x): if x == 1: return 1 else: return x * factorial(x-1) print(factorial(5))

Can anybody tell me how is 120 answer

24th May 2020, 5:39 AM
ANONYMOUS
ANONYMOUS - avatar
2 Answers
+ 1
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 You are right that could be made shorter by giving the math definition here. I have simplified it for me, because it was already described at the beginning of my code. A little advertising is a must.
24th May 2020, 1:35 PM
JaScript
JaScript - avatar
0
An example if you like will be provided i.e. by me.
24th May 2020, 9:29 AM
JaScript
JaScript - avatar