JavaScript&#x27;s scoping is much friendlier for creating closures than Python&#x27;s:<p><pre><code>    def why_is_scoping_hard():
        n = 4
        def print_n():
            print n
        def modify_n(new_value):
            n = new_value
            print n
        return [print_n, modify_n]

    &gt;&gt;&gt; print_n, modify_n = why_is_scoping_hard()
    &gt;&gt;&gt; print_n()
    4
    &gt;&gt;&gt; modify_n(7)
    7
    &gt;&gt;&gt; print_n()
    4
</code></pre>
When you assign to a variable it is automatically created in the local scope, shadowing a variable with the same name from an outer scope. If you don&#x27;t assign to it, you get the value from the outer scope. If you try to print it, but then assign to it later, the print call raises an error.