Created
November 5, 2016 13:11
-
-
Save nadade/c43946eb5096a8e406b5d358bd40a5b8 to your computer and use it in GitHub Desktop.
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
item_numbers = [2, 3, 5] | |
item_definitions = { 1: 'First item', 2: 'Second item', 3: 'Third item', 5: 'Fifth item'} | |
print(80 * '-') | |
print('Plain item names:') | |
items = map(lambda number: item_definitions[number], item_numbers) | |
print(', '.join(items)) | |
print(80 * '-') | |
print('Item names with item numbers:') | |
items = map(lambda number: '{0}({1})'.format(item_definitions[number], number), item_numbers) | |
print(', '.join(items)) | |
print(80 * '-') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment