Increment variable within for loop
<p>I am new to Python and am trying to figure out how to address the following issue. I have two lists, list1 looks like this:</p>

<pre><code>['10','12','12','23]
</code></pre>

<p>And list2 looks like this:</p>

<pre><code>['15','16','13','15']
</code></pre>

<p>I also have a dictionary consisting of the following key-values:</p>

<pre><code>dictionary = {
'10': 'AATGCGTAAGCTAGCGATAGATGCAACGTT', 
'12': 'GGTCAGAGTTTATCGGTATGTTAGCATGGA', 
'23': 'ATGGGCGCGTATATTAAAGGCGCCGCCCTG'
}
</code></pre>

<p>The keys in this dictionary consist of those elements in list1. Each element in list1 is also associated with a single element in list2 (in order, such that '10' in list1 is associated with '15' in list2, '12' in list1 with '16' in list2, etc.). </p>

<p>For each element in list1, I would like to take the associated dictionary value, and insert characters into specific positions using the associated element in list2 to determine the positions. So far I've been working on a for loop to do this:</p>

<pre><code>for i in list1:
    dict_key = dictionary.get(i)
    pos = int(list2[0])
    full = dict_key[:pos] + '[' + dict_key[pos] + ']' +  dict_key[(pos+1):]
    print(full)
</code></pre>

<p>I would like my final output to look like this:</p>

<pre><code>AATGCGTAAGCTAGC[G]ATAGATGCAACGTT
GGTCAGAGTTTATCGG[T]ATGTTAGCATGGA
GGTCAGAGTTTAT[C]GGTATGTTAGCATGGA
ATGGGCGCGTATATT[A]AAGGCGCCGCCCTG
</code></pre>

<p>But my output currently looks like this because I am specifically calling for only index 0 from list2:</p>

<pre><code>AATGCGTAAGCTAGC[G]ATAGATGCAACGTT
GGTCAGAGTTTATCG[G]TATGTTAGCATGGA
GGTCAGAGTTTATCG[G]TATGTTAGCATGGA
ATGGGCGCGTATATT[A]AAGGCGCCGCCCTG
</code></pre>

<p>I want to increase the element that's called for in list2 by 1 with each iteration of the loop, but I can't seem to figure it out. Should I define a new variable using range? Any comments will be appreciated!</p>