Home >>Python Set Methods >Python Set copy() Method

Python Set copy() Method

Python Set copy() Method

Python set copy() method is used to copy the given input set.

Syntax:
set.copy()
Here is an example of Python copy() method:

fruits = {"apple", "banana", "mango"}
x = fruits.copy()
print(x)

Output:
{'mango', 'apple', 'banana'}