I have a list of dictionaries like the following and I want to get a list of the ages of the animals of each owner, for example, the animals of the ana has in average x years ... However I am not able to get the ages of the animals related to their owners, can anyone help?
lista1 =[
{'Idade': '8','Especie': 'Gato', 'Nome do Animal': 'Felix'},
{'Idade': '57','Especie': 'Tartaruga','Nome do Animal': 'Michelangelo'},
{'Idade': '12','Especie': 'Cao', 'Nome do Animal': 'Rantanplian'},
{'Idade': '2','Especie': 'Peixe', 'Nome do Animal': 'Nemo'},
{'Idade': '45','Especie': 'Tartaruga','Nome do Animal': 'Leonardo'},
{'Idade': '9','Especie': 'Cao', 'Nome do Animal': 'Milo'},
{'Idade': '57','Especie': 'Tartaruga','Nome do Animal': 'Raphael'},
{'Idade': '4','Especie': 'Peixe', 'Nome do Animal': 'Dory'}]
lista2 =[
{'Nome do Dono ': 'Ana','Nome do Animal': 'Michelangelo'},
{'Nome do Dono ': 'Eva','Nome do Animal': 'Dory'},
{'Nome do Dono ': 'Ada','Nome do Animal': 'Rantanplan'},
{'Nome do Dono ': 'Ana','Nome do Animal': 'Leonardo'},
{'Nome do Dono ': 'Eva','Nome do Animal': 'Felix'},
{'Nome do Dono ': 'Ana','Nome do Animal': 'Raphael'},
{'Nome do Dono ': 'Eva','Nome do Animal': 'Nemo'}]'
The problem is that I can not use input's or anything like that and the code has to work for any list I put above is just an example. What I have to get (in this example) is:
[{'Ana':'53','Eva':'5','Ada':'12'}]
But first I need to put the ages of the animals of each owner in a list and then average what this is that I am not getting. And in relation to space was right, thank you, I already retired.