adplus-dvertising
frame-decoration

Question

What is the output of the following piece of code when executed in the python shell?
>>> a={1,2,3}
>>> a.intersection_update({2,3,4,5})
>>> a

a.

{2,3}

b.

Error, duplicate item present in list

c.

Error, no method called intersection_update for set data type

d.

{1,4,5}

Posted under Tuples and Sets Python

Answer: (a).{2,3}

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of the following piece of code when executed in the python shell?