Avatar ·

Get a key

📁 словарь, строка, python

"

there is a dictionary:

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

there is a string:

  Stroka =  '"a3a2c'    

if the element is among the dictionary values, it is necessary to derive the key value, if among the keys - then among the keys - then among the keys - then among the keys - then among the keys - then among the keys. Display the value of the key to two lines, values ​​separately from the keys.

i.e. I figured out:

   for  i  in  stroka:   if  i  in  d.keys ():   print  (d [i], end =  '' ')     

but I can’t display the key by value:

   for  j  in  stroka:   if  j  in  d.values ​​():   print  '' )