So if I do this I see the inside and outside id of a & b are different even though I declared a & b global inside.
a = 20 b = 30 c = [1, 2, 3] print(id(a),a, id(b),b, id(c),c) def demo(): global a global b a = 21 b = 31 c[0] = 5 print(id(a),a, id(b),b, id(c),c) demo() >>> %Run test1.py 4428144000 20 4428144320 30 4435940048 [1, 2, 3] 4428144032 21 4428144352 31 4435940048 [5, 2, 3]