I have a dictionary where for a single key there is more than one value. From the dictionary i want to check the value to find the key and also find the index of the value.
genDict2= {"A":["GCT","GCC","GCA","GCG"],
"B":["TAA","TGA","TAG"],
"C":["TGT","TGC"],
"D":["GAT","GAC"]}
alphaSet =[]
for i in range(len(genCollect)):
for k, v in genDict2.items():
if genCollect[i] in v:
alphaSet.append(k)
print(alphaSet)
From this code I can find the key but don't know how to find the index of the value. Suppose if the input is 'GCC TAG GAT' then the output should be 'ABD' and ' 120'.