Python Set Union() Method Syntax

The set union() function has the following syntax in Python:

Syntax: set1.union(set2, set3, set4….)

Parameters: zero or more sets

Return: Returns a set, which has the union of all sets(set1, set2, set3…) with set1. It returns a copy of set1 only if no parameter is passed.

Union() function in Python

Python set Union() Method returns a new set that contains all the items from the original set.

The union of two given sets is the set that contains all the elements of both sets. The union of two given sets A and B is a set that consists of all the elements of A and all the elements of B such that no element is repeated.

Python Set Union

The symbol for denoting union of sets is ‘U’

Similar Reads

Python Set Union() Method Syntax

The set union() function has the following syntax in Python:...

Python set Union() Method Example

Let us see a few examples of the set union() function in Python....

Contact Us