Function Details: intersection

Description


Return the intersection of two sets as a new set.


Extended Description


The intersection() method returns a new set containing elements that are common to both the original set and the specified iterable(s). It can take multiple iterables as arguments. If an element is present in all sets (the original and all specified iterables), it will be included in the result. This method does not modify the original set.


Function Signature


set.intersection(*others: Iterable) -> set

Module: set

Class: set

Parameters



Parameter List


  • other: Iterable

Return


Returns a new set containing elements that are common to the original set and all specified iterables.


Return Type


set

Output

Explanation

This example shows the intersection of two sets.