adplus-dvertising
frame-decoration

Question

What is the output of the following piece of code?
>>> a={1,2,3}
>>> b=a.copy()
>>> b.add(4)
>>> a

a.

{1,2,3}

b.

Error, invalid syntax for add

c.

{1,2,3,4}

d.

Error, copying of sets isn’t allowed

Posted under Python

Answer: (a).{1,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?