-
-
Save IndhumathyChelliah/c06f618e448ab42d49b79be04c5a26ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x="hello" | |
y=x | |
print (x)#Output:hello | |
print (y)#Output:hello | |
#Both x and y will point to same object in memory. | |
print (id(x))#Output:44758688 | |
print (id(y))#Output:44758688 | |
#modifying 'x' value.But 'y' value is not modified | |
x="python" | |
print (x)#Output:python | |
print(y)#Output:hello | |
#Both 'x' and 'y' now point to different object in memory. | |
print (id(x))#Output:44760320 | |
print (id(y))#Output:44758688 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment