I am trying to print out the key associated with a value item in a dictionary if that value item is put forward when I call a function.
For example (and this works):
def test(pet):
dic = {'Dog': 'der Hund' , 'Cat' : 'der Katze' , 'Bird': 'der Vogel'}
items = dic.items()
key = dic.keys()
values = dic.values()
for x, y in items:
if y == pet:
print x
However, whenever I add multiple values to a key it stops working and I don't know why?
dic = {'Dog': ['der Hund', 'der Katze'] , 'Cat' : 'der Katze' , 'Bird': 'der Vogel'}
give me no output it doesn't print x.
Can someone help?