title: Python: nested for loop - name not defined
body: <p>first of all, I must point out that i'm not a programmer, so this is probably a stupid question, but i'd like to understand what's going on here. </p>
  
  <p>The program should go through a string (genome), and slide a window of arbitrary length ('l' in this case). It searches for repeating sequences of characters of a given length (k) and notes the number of occurrences of a sequence. I did manage to find repeated sequences in the whole string, but the said window is troubling me. I tried using a nested loop:</p>
  
  <pre><code>for i in range(len(genome) - k + 1):
      for c in range(len(genome))[c:c+l]:
          kmer = genome[i:i+k]
          if kmer in d:
              d[kmer] += 1
          else:
              d[kmer] = 1
  </code></pre>
  
  <p>I get an error: "NameError: name 'c' is not defined"
  What is the cause of this problem, and is there an easy to comprehend way of fixing it? Efficiency is not really important, so i'd like to keep a similar structure (i found a lot of topics describing ways to avoid using nested for loop, but i find it quite confusing presently).</p>
  
  <p>Thank you in advance.</p>