Python Set - Intersection Method

Method Name: intersection(anotherSet_in)

Method Overview:

The intersection of two sets is given by this method by selecting the elements that are common to both the sets.

Paramters:

anotherSet_in - The second set from which common elements are drawn along with the current/this set, to form the intersection set

Exceptions:

None

Example:

>>> AirCraftParts   = {"Wheels","Engine","Gear","Wings","Tail"}

>>> CarParts        = {"Wheels","Engine","Gear"}

>>> AutomobileParts = AirCraftParts.intersection(CarParts)

>>> print(AutomobileParts)

{'Wheels', 'Engine', 'Gear'}

 


Copyright 2023 © pythontic.com