Factorial¶
Save all functions into the same file named comb.py.
Write the function
factorial()that computes the factorial of a given integer. Examples:>>> factorial (1) 1 >>> factorial (5) 120 >>> factorial (8) 40320 >>> factorial (10) 3628800
Note
More tests are provided in file
test-factorial.txtUse the preceding function and write the function
combinatorial()that takes two positive integes n and m, and returns the combinatorial number \({n \choose m} = {n! \over {m! (n-m)!}}\). Examples:>>> combinatorial(1,1) 1 >>> combinatorial(8, 5) 56
Note
More tests are provided in file
test-combinatorial.txt
Solution
A solution of these functions is provided in the comb.py file.