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 snippet?
‘%d %s %g you’ %(1, ‘hello’, 4.0)

What will be the output of the following Python code snippet?
‘%d %s %g you’ %(1, ‘hello’, 4.0)
a) Error
b) 1 hello you 4.0
c) 1 hello 4 you
d) 1 4 hello you

Answer: c
Explanation: In the snippet of code shown above, three values are inserted into the target string. When we insert more than one value, we should group the values on the right in a tuple. The % formatting expression operator expects either a single item or a tuple of one or more items on its right side.

Join The Discussion