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?
t = ‘%(a)s, %(b)s, %(c)s’
t % dict(a=’hello’, b=’world’, c=’universe’)

What will be the output of the following Python code?
t = ‘%(a)s, %(b)s, %(c)s’
t % dict(a=’hello’, b=’world’, c=’universe’)
a) ‘hello, world, universe’
b) ‘hellos, worlds, universes’
c) Error
d) hellos, world, universe

Answer: a
Explanation: Within the subject string, curly braces represent substitution targets and arguments to be inserted. Hence the output of the code shown above: ‘hello, world, universe’.

Join The Discussion