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.

Is the following Python code valid?
>>> a=(1,2,3)
>>> b=a.update(4,)

Is the following Python code valid?
>>> a=(1,2,3)
>>> b=a.update(4,)
a) Yes, a=(1,2,3,4) and b=(1,2,3,4)
b) Yes, a=(1,2,3) and b=(1,2,3,4)
c) No because tuples are immutable
d) No because wrong syntax for update() method

Answer: c
Explanation: Tuple doesn’t have any update() attribute because it is immutable.

Join The Discussion