निम्नलिखित कोड का परिणाम क्या है ?
What is the output of the following code ?
a = set(‘abc’)
b = set(‘cdef’)
print(a&b) A
{‘c’}
B
{‘a’,’b’,’c’,’d’,’e’,’f’}
C
{c}
D
None of these
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 & bgives the intersection (common elements) of both sets. The common element is'c'.
So, the output is:
{'c'}
Answer: (A) {'c'}.
Correct Answer: A) {‘c’}