Last answered:

10 Nov 2023

Posted on:

10 Nov 2023

0

Making y always equal to x

How can i make y to always be equal to x, without having to manually adjust for y

1 answers ( 0 marked as helpful)
Instructor
Posted on:

10 Nov 2023

1

Hey Adeolu,


Thanks for reaching out!


The idea of y always being equal to x implies that y and x should always reference the same object in the memory. However, since integers are immutable objects in Python, any modification to x would affect its identity. Therefore, upon changing the value of x, y and x would no longer reference the same object.


In short, you can't make y and x always reference the same object upon modifying the variable x.


Kind regards,

365 Hristina

Submit an answer