So, I have a dictionnary
a = {
'a' : 'banana',
'b' : 'orange',
'c' : 'pineapple',
'd' : 'apple' }
I want the keys of banana and orange, so I did :
def dict_values(x) :
print((list(a.keys())[list(a.values()).index(x)]),end=' ')
and
res = ['banana', 'orange']
for r in res :
dict_values(r)
the result is a b
, but I would like a list for the result like list = ['a', 'b']