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

15th Jun 2020, 2:34 PM
Basemalzwawi Alzwawi
Basemalzwawi Alzwawi - avatar
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 😊
15th Jun 2020, 2:38 PM
Hacker Badshah
Hacker Badshah - avatar