CBSE Class 11 Computer Science Question 78 of 98

Python Programming Fundamentals — Question 40

Back to all questions
40
Question

Question 27

Give the output.

a, b, c = 10, 20, 30
p, q, r = c - 5, a + 3, b - 4
print("a and b, :", p, q, r)
Answer
Output
a and b, : 25 13 16
Explanation

In the given code, using multiple assignment, three variables a, b, and c are initially assigned values 10, 20, and 30 respectively and variables p, q, and r are assigned new values: p is assigned c - 5 (resulting in 25), q is assigned a + 3 (resulting in 13), and r is assigned b - 4 (resulting in 16). Finally, the print statement outputs the values of p, q, and r along with the string "a and b, :", resulting in the output: a and b, : 25 13 16.