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?
print(“Hello {0[0]} and {0[1]}”.format((‘foo’, ‘bin’)))

What will be the output of the following Python code?
print(“Hello {0[0]} and {0[1]}”.format((‘foo’, ‘bin’)))
a) Hello foo and bin
b) Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)
c) Error
d) None of the mentioned

Answer: a
Explanation: The elements of the tuple are accessed by their indices.

Join The Discussion