human
What is a the Python program you requested given the following:
I am working on the file "Closure a dekorator.ipynb".
The first task is:
Potrebujeme nejaku strukturu, kde si budeme ukladat priebezne vysledky

Napriklad slovnik
Can you write Python program for it?
assistant
#Here is the Python program you requested.

def memoize(f):
    memo = {}
    counter = 0
    def wrapper(x):
        if x not in memo:
            nonlocal counter # toto by tu nemuselo byt, ale ja chcem vediet kolko som si usetril volani
            memo[x] = f(x)
            counter += 1 # toto by tu nemuselo byt
        return memo[x]
    return wrapper

@memoize
def memoized_fib(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return memoized_fib(n-1) + memoized_fib(n-2)
    
memoized_fib(10)
print(memoized_fib.__closure__[0].cell_contents)

@counter_decorator
def counted_fib(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return counted_fib(n-1) + counted_fib(n-2)
    
counted_fib(10)
print(counted_fib.__closure__[0].cell_contents)