Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Last active July 27, 2020 00:35
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/5094c29169bbbd50c9b87eb9fbac1e83 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/5094c29169bbbd50c9b87eb9fbac1e83 to your computer and use it in GitHub Desktop.
x=5
y=x
#Both x and y are pointing to same int object.
print (id(x))#Output:1547167728
print (id(y))#Output:1547167728
#Modifying value of 'y'
y=10
print (y)
#After modifying 'y' will point to other 'int' object.
print (id(y))#Output:1547167808
#'x' value is not changed.
print (x)#Output:5
print (id(x))#Output:1547167728
print (id(y))#Output:1547167808
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment