CBSE Class 11 Informatics Practices Question 69 of 102

Python Programming Fundamentals — Question 30

Back to all questions
30
Question

Question 23(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 (;).