Wednesday, November 20, 2019

list alias in python

In the list we can make many alias for the single list

x1 = [5, 8, 10, 16, 20]
y=x1
print(x1)
print(y)
print(id(x1))
print(id(y))

output:
[5, 8, 10, 16, 20]
[5, 8, 10, 16, 20]
2576163839240
2576163839240

No comments:

Post a Comment

python class topic video