kyu_7.factorial package

Submodules

kyu_7.factorial.factorial module

Solution for -> Factorial.

Created by Egor Kostan. GitHub: https://github.com/ikostan

kyu_7.factorial.factorial.factorial(n: int) int[source]

Factorial function.

A function to calculate factorial for a given input. If input is below 0 or above 12 throw an exception of type ValueError (Python). :param n: :return:

kyu_7.factorial.test_factorial module

Test for -> Factorial.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_7.factorial.test_factorial.FactorialTestCase(methodName='runTest')[source]

Bases: TestCase

Testing ‘factorial’ function.

_classSetupFailed = False
_class_cleanups = []
test_factorial = None
test_factorial_0(**kw)

Testing ‘factorial’ function [with n=0, expected=1, msg=’factorial for 0 is 1’].

In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example: 5! = 5 * 4 * 3 * 2 * 1 = 120. By convention the value of 0! is 1.

Write a function to calculate factorial for a given input. If input is below 0 or above 12 throw an exception of type ValueError (Python). :return:

test_factorial_1(**kw)

Testing ‘factorial’ function [with n=1, expected=1, msg=’factorial for 1 is 1’].

In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example: 5! = 5 * 4 * 3 * 2 * 1 = 120. By convention the value of 0! is 1.

Write a function to calculate factorial for a given input. If input is below 0 or above 12 throw an exception of type ValueError (Python). :return:

test_factorial_2(**kw)

Testing ‘factorial’ function [with n=2, expected=2, msg=’factorial for 2 is 2’].

In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example: 5! = 5 * 4 * 3 * 2 * 1 = 120. By convention the value of 0! is 1.

Write a function to calculate factorial for a given input. If input is below 0 or above 12 throw an exception of type ValueError (Python). :return:

test_factorial_3(**kw)

Testing ‘factorial’ function [with n=3, expected=6, msg=’factorial for 3 is 6’].

In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example: 5! = 5 * 4 * 3 * 2 * 1 = 120. By convention the value of 0! is 1.

Write a function to calculate factorial for a given input. If input is below 0 or above 12 throw an exception of type ValueError (Python). :return:

Module contents

Factorial.