There are two ways by which we can copy one List to the other.
Let us look at the first way using the 'List( )' method.
x = ["Mohan", "Kriti", "Salim"] y = List(x) print("The Copied List is ",y)
So , in the above code we have created a 'List' and initialised to the variable 'x' .
Below is how the values are positioned in the List ,
Then we have used the 'List( )' method to take the List 'x' as parameter and create a new List that would be the exact copy of 'x' .
Then assign it to 'y' .
And we get the below output ,
Now , let us look at the second way of copying a List using 'copy( )' method.
x = ["Mohan", "Kriti", "Salim"] y = x.copy() print("The Copied List is ",y)
So , in the above code we have created a 'List' and initialised to the variable 'x' .
Below is how the values are positioned in the List ,
Then we have used the 'copy( )' method that would create an exact copy of 'x' . And assign it to 'y' .
And we get the below output ,