I have following code:
my_var=1
def a():  
    def b():
        my_var=2
    b()
    return my_var
print(a())
I'm trying to change the variable my_var in sub-function b(). The result should be 2 instead of 1. But in my code, it doesn't work. How can I solve this problem?
