Avatar ·

Get a key

📁 dictionary, string, Advanced Python Topics

There is a dictionary:

d = {'a': '1', 'b': '2', 'c': '3'}

There is a string:

stroka = 'a3a2c'

If an element is among the dictionary values, it is necessary to output the key value; if among the keys, then output the value of that key. Output in two lines, values separately from keys.

i.e. I figured out: