junctions = [2,9,15,20]
seq_1 = 'sauron'
seq_2 = 'corrupted'
seq_3 = 'numenor'
combined = 'sauroncorruptednumenor' #seq_1 + seq_2 + seq_3
count_1 = 1
count_2 = 1
count_3 = 2
我有一个包含 3 个字符串的列表(seq_1-3)。我将它们组合在一起以创建 1 个长字符串(组合)我有一个索引列表(连接点)。我为每个字符串设置了 3 个不同的计数器为零(count_1-3)
我要做的是在组合序列中找到每个结点 [2,9,15,20] 的位置。. . 如果是从 seq_1 --> count_1 += 1 如果是从 seq_2 --> count_2 += 1 从 seq_3 --> count_3 += 1
例子
junctions = [2,9,15,20]
count_1 = 0
count_2 = 0
count_3 = 0
combined = 'sauroncorruptednumenor'
seq_1 = 'sauron' #index 2 would be on 'u' in combined but originally from seq_1 so count_1 = count_1 + 1
seq_2 = 'corrupted' #index 9 would be on 'r' in combined so count_2 += 1
seq_3 = 'numenor' #index 15 would be 'n' in combined so count_3 += 1, and 20 would be 'o' so count_3 += 1
让我知道我是否需要以不同的方式澄清