If I have 2 lists:
x = [1, 2, 3, 4]
y = [a, b, c, d]
How can I display something like:
1 - a, 2 - b, 3 - c, 4 - d
?
Asked
Active
Viewed 42 times
1

dwnppoalt
- 11
- 1
-
Check out [`zip`](https://docs.python.org/3/library/functions.html#zip) to iterate over both lists together. You also have the option to iterate over the range of indices – shriakhilc Jan 04 '22 at 11:37
-
Does this answer your question? [How to iterate through two lists in parallel?](https://stackoverflow.com/questions/1663807/how-to-iterate-through-two-lists-in-parallel) – Syed Shahzer Jan 04 '22 at 11:37
-
Syed Shahzer This is what I was looking for. Thanks! – dwnppoalt Jan 04 '22 at 11:38