i'm new at Python and i'm tryng to find a solution to thi problem. I have this two nested dictionaries:`
dna_type = {"hair":{"black":"CCAGCAATCGC","brown":"GCCAGTGCCG","blonde":"TTAGCTATCGC"},
"face":{"square":"GCCACGG","round":"ACCACAA","oval":"AGGCCTCA"},
"eye":{"blue":"TTGTGGTGGC","green":"GGGAGGTGGC","brown":"AAGTAGTGAC"},
"gender":{"female":"TGAAGGACCTTC","male":"TGCAGGAACTTC"},
"race":{"white":"AAAACCTCA","black":"CGACTACAG","asian":"CGCGGGCCG"}}
suspects = {"Eva":{"gender":"female","race":"white","hair":"blonde","eye":"blue","face":"oval"},
"Larisa":{"gender":"female","race":"white","hair":"brown","eye":"brown","face":"oval"},
"Matej":{"gender":"male","race":"white","hair":"black","eye":"blue","face":"oval"},
"Miha":{"gender":"male","race":"white","hair":"brown","eye":"green","face":"square"}}
Now i want to compare the two nested dictionaries , finding the DNA matching values and print out the name and its features with the corrispondig DNA sequence. I've tried this:
while True:
for cat,car in dna_type.iteritems():
for name,pers in suspects.iteritems():
if car == pers:
print suspects[name][car]
but i'm still waiting for an output.