adplus-dvertising
frame-decoration

Question

Is the following piece of code valid?
a={3,4,{7,5}}
print(a[2][0])

a.

Yes, 7 is printed

b.

Error, elements of a set can’t be printed

c.

Error, subsets aren’t allowed

d.

Yes, {7,5} is printed

Posted under Python

Answer: (c).Error, subsets aren’t allowed

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Is the following piece of code valid?