Strange behaviour of the program after modifying the dictionary of local variables

I find some strange behavior in my program after modifying the dictionary of local variables, and it makes me confused. If we execute the code below, we will get the result as the image I attached. And now I know I shouldn’t modify the local variables using locals(). i=0 locals()[f’num_{i}’] = i print(num_0) def lc():… Read More Strange behaviour of the program after modifying the dictionary of local variables