I'm java script programmer and start to learn python. I try to revalue local variable in python function. My code :
def first_function():
var1 = 5
def second_function():
var1 = 10
second_function()
print(var1)
first_function()
result this code is
5
but when second_function executed, var1 revalued with '10'. I search in google and find 'global' solution. How can I solve this issue without define global variable. Thanks.