Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following Python code?
>>> a=(2,3,1,5)
>>> a.sort()
>>> a

What will be the output of the following Python code?
>>> a=(2,3,1,5)
>>> a.sort()
>>> a
a) (1,2,3,5)
b) (2,3,1,5)
c) None
d) Error, tuple has no attribute sort

Answer: d
Explanation: A tuple is immutable thus it doesn’t have a sort attribute.

Join The Discussion