def factorial(n):
    return fact_iter(1, 1, n)

def fact_iter(product, counter, max_count):
    return (product
            if counter > max_count
            else fact_iter(counter * product,
                           counter + 1,
                           max_count))

print(factorial(5))

# expected: 120
