About Lesson
Cloning of List Object:-
जब list के object का exact duplicate independent list object बनाते हैं तो उसे cloning कहते हैं।
x=[2,4,6,8]
y=x[:]
print(x) # [2, 4, 6, 8]
print(y) # [2, 4, 6, 8]
y[1]=10
print(y) # [2, 10, 6, 8]
print(x) # [2, 4, 6, 8]
Cloning of List Object:-
When an exact duplicate of a list object is created as an independent list object, it is called cloning.
x=[2,4,6,8]
y=x[:]
print(x) # [2, 4, 6, 8]
print(y) # [2, 4, 6, 8]
y[1]=10
print(y) # [2, 10, 6, 8]
print(x) # [2, 4, 6, 8]