Title: Chain Together Lists
Slug: chain_together_lists
Summary: Chain Together Lists Using Python.
Date: 2017-02-02 12:00
Category: Python
Tags: Basics
Authors: Chris Albon
In [1]:
from itertools import chain
In [2]:
# Create a list of allies
allies = ['Spain', 'Germany', 'Namibia', 'Austria']
# Create a list of enemies
enemies = ['Mexico', 'United Kingdom', 'France']
In [3]:
# For each country in allies and enemies
for country in chain(allies, enemies):
# print the country
print(country)