Here i have a code of python. In this code i define two function and at top one variable a i have created. but when i try to call a in local function with assigning statement below it generate error that local variable not initialized. if i didn't assign it value than it access value of successfully.
a=5
def local():
print("inside local Function before changing %d"%a)
a=3
print("Insie local Function after changing %d"%a)
local()
print("outside local Function after changing %d"%a)
def global_ars():
global a
a=6
print("Inside Global Function %d"%a)
global_ars()
print("outside Global Function %d"%a)
i want to know how can i access to global value and can assign new value but only at local level not on global level.