human
I am working on the file "Closure a dekorator.ipynb".
The first task is:
Daju sa pouzit napriklad na kontrolu vstupov odelenu od samotenho vypoctu
Can you write Python code for it?

Can you provide a the Python code you requested?
assistant
#Here is the Python code you requested.

# https://realpython.com/blog/python/inner-functions-what-are-they-good-for/
def factorial(number):

    # error handling
    if not isinstance(number, int):
        raise TypeError("Sorry. 'number' must be an integer.")
    if not number >= 0:
        raise ValueError("Sorry. 'number' must be zero or positive.")

    # logika spracovania je pekne sustredena na jednom mieste
    def inner_factorial(number):
        if number <= 1:
            return 1
        return number*inner_factorial(number-1)
    return inner_factorial(number)

# call the outer function
print(factorial(4))