I'm relatively new to python and I've been working on an algorithm that involves genetic code. I started by associating all 4 genetic bases, A, C, T, G with a list. A is 1,0,0,0. C is 0,1,0,0. T is 0,0,1,0 and G is 0,0,0,1. There are two different genetic codes, one being the original one and the other being one that was genetically mutated. The algorithm is going to come to conclusions of the data given based on the difference between the two genetic codes. But first, I need to sort of preprocess the data before I can work on the algorithm making conclusions.
The code looks like this so far:
A = [1, 0, 0, 0]
C = [0, 1, 0, 0]
T = [0, 0, 1, 0]
G = [0, 0, 0, 1]
original = [A, T, T, G, C, T, A]
copy = [C, T, T, A, T, A, A]
final = original
for i, v in enumerate(original):
if v == copy[i]:
print(v)
elif v != copy[i]:
final.insert(i, 1)
print(final)
The error that I'm getting is that "index is out of range". However, the program still runs but the error shows up. Firstly, should I be worried about this in the first place and does it mean anything? Second, if it is a big deal, how should I fix this? If it's not, why is it happening in the first place? I also tried different code compliers like google collab and Pycharm.
I'm fairly new to Python so there could be something small I'm overlooking. Any help would be really appreciated!