+ 2

Can Anyone explain it please!

def factorial(x): if x == 1: return 1 else: return x * factorial(x-1) print(factorial(44)) https://code.sololearn.com/cimOkDECT11G/?ref=app

1st Nov 2020, 12:05 PM
Nafis Sadiq Bhuyan
Nafis Sadiq Bhuyan - avatar
4 Respuestas
1st Nov 2020, 12:17 PM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar
1st Nov 2020, 12:18 PM
JaScript
JaScript - avatar
+ 3
thanks you all
2nd Nov 2020, 11:11 AM
Nafis Sadiq Bhuyan
Nafis Sadiq Bhuyan - avatar
+ 1
In shortcut: 44*fact(44-1 or 43) 44*43*fact(43-1 or 42) 44*43*42*fact(42-1) ... 44*43*...*2*fact(1) 44*43*...*2*1[since fact(1) returns 1] It's a recursive function!
2nd Nov 2020, 9:43 AM
Md. Faheem Hossain
Md. Faheem Hossain - avatar