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?
‘The {} side {1} {2}’.format(‘bright’, ‘of’, ‘life’)

What will be the output of the following Python code?
‘The {} side {1} {2}’.format(‘bright’, ‘of’, ‘life’)
a) Error
b) ‘The bright side of life’
c) ‘The {bright} side {of} {life}’
d) No output

Answer: a
Explanation: The code shown above results in an error. This is because we have switched from automatic field numbering to manual field numbering, that is, from {} to {1}. Hence this code results in an error.

Join The Discussion