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!r} and {0!s}”.format(‘foo’, ‘bin’))

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

Answer: b
Explanation: !r causes the characters ‘ or ” to be printed as well.

Join The Discussion