Problem: an error occurs when the code looks like:

    x = 23
    def f():
        print(x)
        x = 42
    f()
    

    Solution: use global or nonlocal.