I was trying out a few things with scopes in python and came into a little problem. I have this code here. I want to change the variable var
from within a nested function.
def func_1():
var = 1
def func_2():
var = 2
func_2()
print(var)
func_1()
When func_1()
is run, var
is still 1. Is it possible to edit var
under func_2
?