KnowledgeBoat Logo

Computer Science

Find the output generated by following code fragments :

a, b, c, d = (1, 2, 3)

Python Tuples

5 Likes

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.

Answered By

3 Likes


Related Questions