Computer Science
Predict the output
a, b, c = 10, 20, 30
p, q, r = c - 5, a + 3, b - 4
print ('a, b, c :', a, b, c, end = '')
print ('p, q, r :', p, q, r)
Answer
Output
a, b, c : 10 20 30p, q, r : 25 13 16
Explanation
a, b, c = 10, 20, 30
⇒ assigns initial value of 10 to a, 20 to b and 30 to c.p, q, r = c - 5, a + 3, b - 4
⇒ p, q, r = 30 - 5, 10 + 3, 20 - 4
⇒ p, q, r = 25, 13, 16.
So p is 25, q is 13 and r is 16.print ('a, b, c :', a, b, c, end = '')
⇒ This statement printsa, b, c : 10 20 30
. As we have given end = '' so output of next print statement will start in the same line.print ('p, q, r :', p, q, r)
⇒ This statement printsp, q, r : 25 13 16