def temp():
    temparray = ['a','b']
    temparray_2 = ['c','d','e']
    for i in temparray:
        print('i:' + str(i))
        for i in temparray_2:
            print('first: ' + str(i))
        print('Second: ' + str(i))
    print('final: ' + str(i))
Why does the above code the following output? The variable i seems to get overwritten by whatever that is last assigned in the inner loop. Does python not obey the scoping rule like Java or C?
i:a
first: c
first: d
first: e
Second: e
i:b
first: c
first: d
first: e
Second: e
final: e
 
    