adplus-dvertising
frame-decoration

Question

What is the output of the following piece of code?
>>> a=[(2,4),(1,2),(3,9)]
>>> a.sort()
>>> a

a.

[(1, 2), (2, 4), (3, 9)].

b.

[(2,4),(1,2),(3,9)].

c.

Error because tuples are immutable

d.

Error, tuple has no sort attribute

Posted under Tuples and Sets Python

Answer: (d).Error, tuple has no sort attribute

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?