Explanation:
1. print() Function
print(...)
Explanation:
print() is a built-in Python function.
It displays the result on the screen (console).
Whatever is inside the parentheses () is printed.
2. First Set
{1, 2, 3}
Explanation:
Curly braces {} create a set.
A set is an unordered collection of unique elements.
This set contains:
1
2
3
3. Second Set
{2, 3, 4}
Explanation:
This is another set.
It contains:
2
3
4
4. & Operator (Intersection Operator)
{1, 2, 3} & {2, 3, 4}
Explanation:
The & operator finds the intersection of two sets.
Intersection means the elements that are present in both sets.
Comparison
First Set Second Set Common?
1 No ❌
2 Yes ✅
3 Yes ✅
4 No ❌
Common elements: {2, 3}
5. print() Displays the Result
print({2, 3})
Explanation:
After finding the intersection, Python prints the resulting set.
Output
{2, 3}

0 Comments:
Post a Comment