0
def factorial(n): print("factorial has been called with n = " + str(n)) if n == 1: return 1 else: res = n * factorial(n-1) print
Could anyone explain to me, couldn't get it
1 Odpowiedź
0
It's all much mixed up but it's a code for finding factorial of a number:
def factorial(n):
if n == 1:
return 1
else:
return factorial(n-1) * n
print(factorial(5)) #120
May it Helps You 😊