Write a function that prints the dictionary in the following manner:
Key : GT - Value : 1
Key : CT - Value : 8
Code:
def occurrences2letters(sequence):
dico = {}
for i in range(len(sequence)-1):
key = sequence[i]+sequence[i+1]
dico[key] = dico.get(key,0) + 1
return dico
I got {'AC': 1, 'CC': 3, 'CT': 8, 'TA': 7, 'AG': 7, 'GC': 7, 'CA': 1, 'AT': 2, 'TG': 2, 'GT': 1, 'GA': 1, 'AA': 1, 'TC': 2, 'CG': 1, 'GG': 1, 'TT': 2}
Now I want another code helping me to have the result showed in the beginning. For the moment I have written that part of the code but it doesn't work
def printDico(dico):
for key in dico:
print("Key : "+str(key)+" - Value : "+str(dico[key]))