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?
‘{a}, {0}, {abc}’.format(10, a=2.5, abc=[1, 2])

What will be the output of the following Python code?
‘{a}, {0}, {abc}’.format(10, a=2.5, abc=[1, 2])
a) Error
b) ‘2.5, 10, [1, 2]’
c) 2.5, 10, 1, 2
d) ’10, 2.5, [1, 2]’

Answer: b
Explanation: Since we have specified that the order of the output be: {a}, {0}, {abc}, hence the value of associated with {a} is printed first followed by that of {0} and {abc}. Hence the output of the code shown above is: ‘2.5, 10, [1, 2]’.

Join The Discussion