'Can I access memory location and values ( pointers and reference ) for variables in a loop, in Python 3

my_num_1 = 10
my_num_2 = 20

# I want to assign value 5 to above two variables like this:

for num in [my_num_1, my_num_2]:
    num = 5

That won't work. So is there a way to do something like this pseudo code:

for num in [(address_of)my_num_1, (address_of)my_num_2]:
    (value_at)num = 5

The code and application is terrible I know. But is there a way to play around with pointers and (de)referencing in Python like this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source