Python - when one integer variable is changed, make the second variable the same -


i have 2 integers x , y equal each other. whenever change x want change reflected in y. how can python?

i think can achieved somehow pointing both variables 'memory location' value stored.

lists , dictionaries act pointers in python hacky version of you're attempting might this:

in [16]: x = y = [0]  in [17]: x out[17]: [0]  in [18]: y out[18]: [0]  in [19]: x[0] = 10  in [20]: y out[20]: [10]  in [21]: x out[21]: [10] 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -