I know this is a duplicate. However, the answer to that particular question does not work for me. Link to the question here.
How do you print the key of a dictionary from the dictionary's value?
My code:
xdict = {
"Phenylalanine": ["UUU", "UUC"], "Leucine": ["UUA", "CUU", "CUC", "CUA", "CUG", "UUG"],
"Isoleucine": ["AUU", "AUC", "AUA"], "Methionine": "AUG", "Valine": ["GUU", "GUC", "GUA", "GUG"],
"Serine": ["UCU", "UCC", "UCA", "UCG"], "Proline": ["CCU", "CCC", "CCA", "CCG"],
"Threonine": ["ACU", "ACC", "ACA", "ACG"], "Alanine": ["GCU", "GCC", "GCA", "GCG"],
"Tyrosine": ["UAU", "UAC"], "Histidine": ["CAU", "CAC"], "Glutamine": ["CAA", "CAG"],
"Asparagine": ["AAU", "AAC"], "Lysine": ["AAA", "AAG"], "Asparatic Acid": ["GAU", "GAC"],
"Glutamic Acid": ["GAA", "GAG"], "Cysteine": ["UGU", "UGC"], "Trytophan": "UGG",
"Arginine": ["CGU", "CGC", "CGA", "CGG", "AGG", "AGA"], "Serine": ["AGU", "AGC"],
"Glycine": ["GGU", "GGC", "GGA", "GGG"]
}
a = input("Enter your DNA sequence: ")
print(list(xdict.keys())[list(xdict.values()).index(a)])