PEP 20 states “There should be one– and preferably only one –obvious way to do it.” The preferred way to iterate through a pair of lists is to declare two variables in a loop expression, and then call zip(list_one,list_two), where list_one and list_two are the two lists you wish to iterate through. For each loop iteration, Python will automatically assign the first variable as the next value in the first list, and the second variable as the next value in the second list.

The code below defines a variable index which serves as an index variable for iterating through two lists. Within the for loop the code accesses the corresponding value for each list by using the index variable. This is a common way for iterating through two lists, but it is not the preferred way in Python.

The updated code below demonstrates the Pythonic style for iterating through a pair of lists. When the code defines two variables in its for loop in conjunction with a call to zip(numbers,letters) on the pair of lists, Python automatically assigns the first variable as the next value in the first list, and the second variable as the next value in the second list.