Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created July 25, 2020 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/c06f618e448ab42d49b79be04c5a26ac to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/c06f618e448ab42d49b79be04c5a26ac to your computer and use it in GitHub Desktop.
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