CBSE Class 11 Computer Science Question 65 of 98

Python Programming Fundamentals — Question 27

Back to all questions
27
Question

Question 20(c)

Find out the error(s) in the following code fragment:

a, b, c = 2, 8, 9
print(a, b, c)
c, b, a + a, b, c
print(a; b; c)
Answer

There are two errors in this code fragment:

  1. The line c, b, a + a, b, c attempts to unpack values but is incomplete and incorrect. It lacks a right-hand side (RHS) to assign values from.

  2. In the line print(a; b; c), the print function should use commas (,) to separate arguments, not semicolons (;).