Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Last active July 27, 2020 00:35
Embed
What would you like to do?
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