I was surprised today by the following code:
testcases = [([1, 1, 1], 2, 2)]
for a, b, c in testcases:
print(a, b, c)
it prints:
[1, 1, 1] 2 2
I expected an error and thought we'd need a second loop to get to tuples' elements. Could enyone explain to me how it works? I don't get how a, b and c are assigned. I used Python 3.6. Cheers!