list_of_letters = ["A", "B", "C"] list_of_ids = [1, 2, 3] # bad practice for i in range(len(list_of_letters)): letter = list_of_letters[i] id_ = list_of_ids[i] process_letters(letter, id_) # good practice # list(zip(list_of_letters, list_of_ids)) = [("A", 1), ("B", 2), ("C", 3)] for letter, id_ in zip(list_of_letters, list_of_ids): process_letters(letter, id_)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter