Last active
May 10, 2016 21:43
-
-
Save mattroyer/23bf246af5e703453b8efd6f50ea1d2f to your computer and use it in GitHub Desktop.
Zip Lists Together
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
families = [["Jenny", "Dana", "Tana", "Shawn", "Mark"], ["Kevin", "Jamison", "Brian", "Alice"], ["Chris", "John", "April"], ["Kevin", "Jim", "Bobby", "Ryan"]] | |
surnames = ['Richards', 'Millhouse', 'Carmichael', 'Williams'] | |
for index, name in enumerate(surnames): | |
families[index] = list(map(lambda x: "%s %s" % (x, name), families[index])) | |
for family in families: | |
print(family) | |
#=> ['Jenny Richards', 'Dana Richards', 'Tana Richards', 'Shawn Richards', 'Mark Richards'] | |
# ['Kevin Millhouse', 'Jamison Millhouse', 'Brian Millhouse', 'Alice Millhouse'] | |
# ['Chris Carmichael', 'John Carmichael', 'April Carmichael'] | |
# ['Kevin Williams', 'Jim Williams', 'Bobby Williams', 'Ryan Williams'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment