KnowledgeBoat Logo

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)

Python

Python Funda

62 Likes

Answer

Output

a, b, c : 10 20 30p, q, r : 25 13 16

Explanation

  1. a, b, c = 10, 20, 30 ⇒ assigns initial value of 10 to a, 20 to b and 30 to c.
  2. 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.
  3. print ('a, b, c :', a, b, c, end = '') ⇒ This statement prints a, b, c : 10 20 30. As we have given end = '' so output of next print statement will start in the same line.
  4. print ('p, q, r :', p, q, r) ⇒ This statement prints p, q, r : 25 13 16

Answered By

27 Likes


Related Questions