Binomialkoeffizient

facts = {}
def fact(n):
    if n == 1:
        return 1
    elif facts.get(n) is not None:
        return facts[n]
    else:
        facts[n] = n * fact(n-1)
        return facts[n]
    
def binomial_coefficient(n, k):
    if n == 0 or k == 0 or k == n:
        return 1
    a = fact(n)
    b = fact(k)
    c = fact(n-k)
    return a//(b*c) 
fmoeran