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?
s='{0}, {1}, and {2}’
s.format(‘hello’, ‘good’, ‘morning’)

What will be the output of the following Python code?
s='{0}, {1}, and {2}’
s.format(‘hello’, ‘good’, ‘morning’)
a) ‘hello good and morning’
b) ‘hello, good, morning’
c) ‘hello, good, and morning’
d) Error

Answer: c
Explanation: Within the subject string, curly braces designate substitution targets and arguments to be inserted either by position or keyword. Hence the output of the code shown above:’hello, good,and morning’.

Join The Discussion