I was working with some iterators and flexible arguments in Python. And I’m running into this error.
The code here is
a = (1,2,3,4)
b = ('a', 'b', 'c', 'd')
z = zip(a,b)
print(*z)
lval, rval = zip(*z)
print(lval)
print(rval)
I know when * is used before an iterator, it lets us unpack the sequence. To quote an example,
print(*range(4))
# output would be numbers: 0 1 2 3 which is not a list; each value is of type <int>
What I’m trying to do here is that I’m unpack the variable z into its initial given tuples a and b.
If someone could explain what is going wrong here, that’d be a really great help.