I have a list containing the basic letters of RNA and a dictionary for converting them to numerical values. What I'm trying to do is save these numeric values ββto a new list. I have:
RNA_list = ['C', 'G', 'A', 'U']
RNA_dictionary = {'A': 1, 'U': 2, 'C': 3, 'G': 4}
for i in RNA_list:
if i in RNA_dictionary:
RNA_integers = RNA_dictionary[i]
else:
print()
So, RNA_integers are 3, 4, 1, 2, but I need to store them in a list somehow. I wanted to do something like:
RNA_integer_list = []
for i in RNA_integers:
RNA_integer_list = RNA_integer_list + i
But this leads to an error because the for loop cannot iterate over integers. I am new to Python, so I donβt know how to approach this. If anyone else can help me, I would really appreciate it!
source
share