CBSE Class 11 Computer Science Question 66 of 114

Tuples — Question 3

Back to all questions
3
Question

Question 1(c)

Find the output generated by following code fragments :

(a, b, c, d) = (1, 2, 3)
Answer
Output
ValueError: not enough values to unpack (expected 4, got 3)
Explanation

Tuple unpacking requires that the list of variables on the left has the same number of elements as the length of the tuple. In this case, the list of variables has one more element than the length of the tuple so this statement results in an error.