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?
>>> import collections
>>> a=collections.namedtuple(‘a’,[‘i’,’j’])
>>> obj=a(i=4,j=7)
>>> obj

What will be the output of the following Python code?
>>> import collections
>>> a=collections.namedtuple(‘a’,[‘i’,’j’])
>>> obj=a(i=4,j=7)
>>> obj
a) a(i=4, j=7)
b) obj(i=4, j=7)
c) (4,7)
d) An exception is thrown

Answer: a
Explanation: The above piece of code illustrates the concept of named tuples.

Join The Discussion