Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to combine the output of multiple lists in python

countries = ['USA', 'Canada', 'UK', 'Australia']
cities = ['Washington', 'Ottawa', 'London', 'Canberra']

for x, y in zip(countries, cities):
  print('The capital of {} is {}.'.format(x, y))


# Output

# The capital of USA is Washington.
# The capital of Canada is Ottawa.
# The capital of UK is London.
# The capital of Australia is Canberra.
Source by www.kdnuggets.com #
 
PREVIOUS NEXT
Tagged: #How #combine #output #multiple #lists #python
ADD COMMENT
Topic
Name
6+6 =