adplus-dvertising
frame-decoration

Question

What is the output of the following code?
>>> a={1,2,3}
>>> {x*2 for x in a|{4,5}}

a.

{2,4,6}

b.

Error, set comprehensions aren’t allowed

c.

{8, 2, 10, 4, 6}

d.

{8,10}

Posted under Python

Answer: (c).{8, 2, 10, 4, 6}

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