7 kyu

Swap items in a dictionary

1,520 of 2,054Avanta

Description:

In this kata, you will take the keys and values of a dict and swap them around.

You will be given a dictionary, and then you will want to return a dictionary with the old values as the keys, and list the old keys as values under their original keys.

For example, given the dictionary: {'Ice': 'Cream', 'Age': '21', 'Light': 'Cream', 'Double': 'Cream'},

you should return: {'Cream': ['Ice', 'Double', 'Light'], '21': ['Age']}

Notes:

  • The dictionary given will only contain strings
  • The dictionary given will not be empty
  • You do not have to sort the items in the lists
Fundamentals
Arrays
Logic

Stats:

CreatedDec 1, 2017
PublishedDec 1, 2017
Warriors Trained3243
Total Skips40
Total Code Submissions4317
Total Times Completed2054
Python Completions1520
JavaScript Completions543
Haskell Completions27
Total Stars48
% of votes with a positive feedback rating94% of 309
Total "Very Satisfied" Votes272
Total "Somewhat Satisfied" Votes34
Total "Not Satisfied" Votes3
Total Rank Assessments11
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Avanta Avatar
  • natan Avatar
  • Blind4Basics Avatar
  • farhanaditya Avatar
Ad