I have a list composed of [start position, stop position, [sample names with those positions]]
My goal is to remove the duplicates with exact start and stop positions and just add the extra sample to the sample names section. The problem I'm encountering is that when I delete from the list, I end up with an out of range error, because it's not recalculating the len(list)
within the loops.
for g in range (len(list)) :
for n in range(len(list)):
#compares the start and stop position of one line to the start and stop of another line
if (list[g][0]==list[n+1][0] and list[g][1]==[n+1][1])
#adds new sample numbers to first start and stop entry with duplication
labels1=list[g][2]
labels2=list[n+1][2]
labels=labels1+labels2
list[g][2]=labels
#now delete the extra line
del list[n+1]