Huge Factorial
Factorials grow into very large numbers quickly, so the result is returned as a string. The function extra_long_factorials receives an integer n and calculates n!, the product of all whole numbers from 1 to n. Remember that the factorial of 0 is 1.
Примеры
Ввод
5Вывод
"120"Ввод
0Вывод
"1"Ввод
1Вывод
"1"Нужно реализовать
def extra_long_factorials(n: int) -> str:
Теги
mathrecursion
Prisijunkite, kad matytumėte pateikimų istoriją
PrisijungtiPrisijunkite, kad naudotumėte DI mentorių
PrisijungtiVisible tests
1
Input
5Expected
"120"2
Input
0Expected
"1"3
Input
1Expected
"1"4
Input
10Expected
"3628800"5
Input
25Expected
"15511210043330985984000000"6
Input
-100Expected
"1"Focus radio
Paused · SomaFM · Fluid