There are two ways by which we can copy one Set to the other.
Let us look at the first way using the 'set( )' method.
x = {"Mohan", "Kriti", "Salim"} y = set(x) print("The Copied Set is ",y)
So , in the above code we have created a 'Set' and initialised to the variable 'x' .
Below is how the values are positioned in the Set ,
Then we have used the 'set( )' method to take the Set 'x' as parameter and create a new Set 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 Set using 'copy( )' method.
x = {"Mohan", "Kriti", "Salim"} y = x.copy() print("The Copied Set is ",y)
So , in the above code we have created a 'Set' and initialised to the variable 'x' .
Below is how the values are positioned in the Set ,
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 ,