Mar-24-2022, 07:41 PM
Zip returns an iterator. You can loop over that iterator to get the elements, or you can assign all the elements.
But since you hand your zip iterables that all have 4 elements, your zip iterator will also have 4 elements.
This means if you try to assign it to (xp, yp, m), it will complain that 4 elements can't fit into 3 variables. I can't tell from your program if you mean for xp to have the first "set" from the zip or if you expected it to have the "a" portion.
zip([1,2,3,4], [5,6,7,8]) => (1,5), (2,6), (3,7), (4,8) # 4 elements.
Describe more what you want those variables to contain, but looping over a zip is pretty natural.
But since you hand your zip iterables that all have 4 elements, your zip iterator will also have 4 elements.
This means if you try to assign it to (xp, yp, m), it will complain that 4 elements can't fit into 3 variables. I can't tell from your program if you mean for xp to have the first "set" from the zip or if you expected it to have the "a" portion.
zip([1,2,3,4], [5,6,7,8]) => (1,5), (2,6), (3,7), (4,8) # 4 elements.
Describe more what you want those variables to contain, but looping over a zip is pretty natural.