Knowee
Questions
Features
Study Tools

Select the correct answerWhat is the output of the following program?ct1 = '{2}, {0} and {1}'.format('p', 'q', 'r')ct2 = '{0}{1}{0}'.format('oprq', 'qrp')print(ct1, ct2)Optionsa, b and c abracadcadr, p and q oprqqrpoprqp, q and r pqrprpdpqrp r, q and p pqrprpd0

Question

Select the correct answerWhat is the output of the following program?ct1 = '{2}, {0} and {1}'.format('p', 'q', 'r')ct2 = '{0}{1}{0}'.format('oprq', 'qrp')print(ct1, ct2)Optionsa, b and c abracadcadr, p and q oprqqrpoprqp, q and r pqrprpdpqrp r, q and p pqrprpd0

🧐 Not the exact question you are looking for?Go ask a question

Solution

The output of the program will be "r, p and q oprqqrpoprq". This is because in the first formatted string, the numbers in the curly brackets refer to the index of the arguments in the format function. So {2} refers to 'r', {0} refers to 'p', and {1} refers to 'q'. In the second formatted string, {0} refers to 'oprq' and {1} refers to 'qrp'. Therefore, the correct answer is "r, p and q oprqqrpoprq".

This problem has been solved

Similar Questions

What will be the output of the following code?a = "abce" >= "abcdef"print(a)Options: Pick one correct answer from belowTrueFalseBoth A and BNone of the Above

Select the correct answerWhat will be the output of the following Python code?>>>ct1="codetantra">>>ct1[:3]>>>Optionscododetacodetantrade

Select the correct answerWhat will be the output of the following Python function?print(hex(10))Optionsa0Xa0xa0xa

Select the correct answerWhat will be the output of the following Python code?def demo(p,q):  if(p == 0):    return q  else:    return demo(p-1,p+q)print(demo(4,5))Options513Infinite loop15

Select the correct answerWhat will be the output of the following Python code snippet?ct = 'code'for i in range(len(ct)):   i.upper()print (ct)Optionsc o d eerror0 1 2 3none of the mentioned

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.