Multiply Down the Line
Factorial appears often in math and recursion practice: it is the product of all whole numbers from 1 to n. The function factorial receives a non-negative integer n and returns its factorial. Remember the special rule: the factorial of 0 is 1.
Примеры
Ввод
0Вывод
1Ввод
1Вывод
1Ввод
5Вывод
120Нужно реализовать
def factorial(n: int) -> int:
Теги
mathrecursion
Jelentkezz be a beküldési előzmények megtekintéséhez
BejelentkezésJelentkezz be az MI-mentor használatához
BejelentkezésVisible tests
1
Input
0Expected
12
Input
1Expected
13
Input
5Expected
1204
Input
6Expected
7205
Input
10Expected
36288006
Input
3Expected
6Focus radio
Paused · SomaFM · Fluid