Looping Over Two Lists

Want to learn more? I recommend these Python books: Python for Data Analysis, Python Data Science Handbook, and Introduction to Machine Learning with Python.

# Create a list of length 3:
armies = ['Red Army', 'Blue Army', 'Green Army']

# Create a list of length 4:
units = ['Red Infantry', 'Blue Armor','Green Artillery','Orange Aircraft']
# For each element in the first list,
for army, unit in zip(armies, units):
    # Display the corresponding index element of the second list:
    print(army, 'has the following options:', unit)
Red Army has the following options: Red Infantry
Blue Army has the following options: Blue Armor
Green Army has the following options: Green Artillery

Notice that the fourth item of the second list, orange aircraft, did not display.