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
Similar Kata:
Stats:
Created | Dec 1, 2017 |
Published | Dec 1, 2017 |
Warriors Trained | 3243 |
Total Skips | 40 |
Total Code Submissions | 4317 |
Total Times Completed | 2054 |
Python Completions | 1520 |
JavaScript Completions | 543 |
Haskell Completions | 27 |
Total Stars | 48 |
% of votes with a positive feedback rating | 94% of 309 |
Total "Very Satisfied" Votes | 272 |
Total "Somewhat Satisfied" Votes | 34 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 11 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |