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=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