Skip to content

Instantly share code, notes, and snippets.

@nadade
Created November 5, 2016 13:11
Show Gist options
  • Save nadade/c43946eb5096a8e406b5d358bd40a5b8 to your computer and use it in GitHub Desktop.
Save nadade/c43946eb5096a8e406b5d358bd40a5b8 to your computer and use it in GitHub Desktop.
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