KnowledgeBoat Logo

Computer Science

Carefully read the given code fragments and figure out the errors that the code may produce.

t = ( 'a', 'b', 'c', 'd', 'e') 
a, b, c, d, e, f = t

Python Tuples

1 Like

Answer

Output
ValueError: not enough values to unpack (expected 6, got 5)   
Explanation

In tuple unpacking, the number of elements in the left side of assignment must match the number of elements in the tuple.
Here, tuple t contains 5 elements where as left side contains 6 variables which leads to mismatch while assigning values.

Answered By

1 Like


Related Questions