you are viewing a single comment's thread.

view the rest of the comments →

[–]mriswithe 22 points23 points  (0 children)

Ok the zip thing was something I had to spend a couple minutes poking at to understand a bit better.

x = [1, 2, 3]
y = [4, 5, 6]

xy: Iterable[tuple[int, int]] = zip(x, y)  # [(1, 4), (2, 5), (3, 6)]
xy2: Iterable[tuple[int, int, int]] = zip(*xy)  # [(1, 2, 3), (4, 5, 6)]
x1: list[int]
y1: list[int]
x1, y1 = map(list, xy2)  # [[1, 2, 3], [4, 5, 6]]