Write a programExercise 1/4Basic10 XP
A reversed dictionary
Task
Write a function obrat(slovnik) that returns a new dictionary with the keys and values swapped: {"pes": "dog", "mačka": "cat"} becomes {"dog": "pes", "cat": "mačka"}.
You may assume the values do not repeat. The original dictionary must not change.
Examples
Call
print(obrat({"pes": "dog", "mačka": "cat"}))Expected output
{'dog': 'pes', 'cat': 'mačka'}
After you submit, 3 hidden tests will also check your solution: an empty dictionary, numbers as keys, the original stays the same.
Python starts the first time you run code.
Ctrl+Enter runs the program. Tab indents. Press Esc, then Tab, to leave the editor.
Input (stdin)
Each line = one call to input().
Output
Hints
Try it yourself first. Each hint reveals a little more - and lowers the reward a little.
Signed out, hints are free - but no XP is awarded either.
Solution
The solution unlocks after the last hint.