निम्नलिखित कोड का परिणाम क्या है ?
What is the output of the following code ?
a = set(‘abc’)
b = set(‘cdef’)
print(a&b)
A)
B)
C)
D)
Explanation:
Here’s a quick explanation:
a = set('abc')
creates a set{'a', 'b', 'c'}
.b = set('cdef')
creates a set{'c', 'd', 'e', 'f'}
.a & b
gives the intersection (common elements) of both sets. The common element is'c'
.
So, the output is:
{'c'}
Answer: (A) {'c'}.