Warning! It seems that you are using Dodona within another webpage, so not everything may work properly. Let your teacher know so that he can solve the problem by adjusting a setting in the learning environment. In the meantime, you can click this link to open Dodona in a new window.
Warning! The page was not fully loaded, probably because of a network issue. It could be that not all functionalities work as expected. Please try reloading the page.
Triton City
Sign in to test your solution.
def factorial(n):
"""
Computes the factorial of n.
>>> factorial(10)
3628800
>>> factorial(32)
263130836933693530167218012160000000
"""
def binomial(n, k):
"""
Computes the bionomial coefficient index by n and k.
>>> binomial(7, 3)
35
>>> binomial(12, 4)
495
"""
def triangular(n):
"""
Computes the n-th triangular number.
>>> triangular(10)
55
>>> triangular(32)
528
"""
def tetrahedral(n):
"""
Computes the n-th tetrahedral number.
>>> tetrahedral(10)
220
>>> tetrahedral(32)
5984
"""
if __name__ == '__main__':
import doctest
doctest.testmod()