Question: Problem Submissions Leaderboard Discussions A.intersection(B) or A&B .intersection) The intersection0 operator returns the intersection of a set and the set of elements in an iterable



Problem Submissions Leaderboard Discussions A.intersection(B) or A&B .intersection) The intersection0 operator returns the intersection of a set and the set of elements in an iterable Sometimes, the & operator is used in place of the .intersection0 operator, but it only operates on the set of elements in set. The set is immutable to the .intersection0 operation (or & operation). sset ("Hacker") >>> print s.intersection("Rank") set (['a', 'k']) >>> print s.intersection (set(L'R', 'a', 'n', 'k'])) set (['a', 'k']) >>> print s.intersection(['R', 'a', 'n', 'k']) set (['a', 'k']) >>> print s.intersection (enumerate(['R', 'a', 'n', 'k'])) set([]) >>print s.intersection ("Rank":1) set([]) >>s & set("Rank") set (['a', 'k'])
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
