There is a dictionary:
d = {'a': '1', 'b': '2', 'c': '3'}
and there is a line:
stroka = 'a3a2c'
If the string element is among the dictionary values, you must output the key that corresponds to the value. If among the keys, then output the value by key value. Output must be in two lines, the values are separate from the keys.
Т.е. для строки 'a3a2c' ожидаемый вывод '113' и 'cb'
How to display values by key - I figured out:
for i in stroka: if i in d.keys(): print(d[i], end='')
But I can't get the key by value:
for j in stroka: if j in d.values(): print(?????, end='')