adplus-dvertising
frame-decoration

Question

What is the output of this code?
s1={1, 2, 3, 8}
s2={3, 4, 5, 6}
s1|s2
s1.union(s2)

a.

{3}
{1, 2, 3, 4, 5, 6, 8}

b.

{1, 2, 4, 5, 6, 8}
{1, 2, 4, 5, 6, 8}

c.

{3}
{3}

d.

{1, 2, 3, 4, 5, 6, 8}
{1, 2, 3, 4, 5, 6, 8}

Posted under Tuples and Sets Python

Answer: (d).{1, 2, 3, 4, 5, 6, 8}
{1, 2, 3, 4, 5, 6, 8}

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 this code?