26
Question Question 3(j)
Carefully read the given code fragments and figure out the errors that the code may produce.
t = ( 'a', 'b', 'c', 'd', 'e')
x, y, z, a, b = t
Output
The code executes successfully without giving any errors. After execution of the code, the values of the variables are:
x ⇒ a
y ⇒ b
z ⇒ c
a ⇒ d
b ⇒ e
Explanation
Here, Python assigns each of the elements of tuple t to the variables on the left side of assignment operator. This process is called Tuple unpacking.