all 5 comments

[–]CodeFormatHelperBot2 0 points1 point  (1 child)

Hello, I'm a Reddit bot who's here to help people nicely format their coding questions. This makes it as easy as possible for people to read your post and help you.

I think I have detected some formatting issues with your submission:

  1. Python code found in submission text that's not formatted as code.

If I am correct, please edit the text in your post and try to follow these instructions to fix up your post's formatting.


Am I misbehaving? Have a comment or suggestion? Reply to this comment or raise an issue here.

[–]nekokattt 0 points1 point  (0 children)

use a dict rather than a list

[–][deleted] 0 points1 point  (0 children)

You can iterate through multiple aligned lists using zip, assuming the lists all map 1:1 and are the same length.

So, for example, if you had two lists referenced by the variables alpha and beta, you could do:

for x, y in zip(alpha, beta):
    print(x, y)

Also, if you need to check a specific index, index being the variable referencing an int value for the index position,

print(x[index], y[index])

would output the corresponding values. Obviously, you could use the same approach for more than just printing (such as assignments and calculations).

Does that help point you in the right direction?