title: How do you access a list in group of 3 in python?
body: <pre><code>origCodon = ([orig[i: i + groupSize] for i in range(len(orig) + 1 - groupSize)])
  patCodon = ([pat[i: i + groupSize] for i in range(len(pat) + 1 - groupSize)])
  print (patCodon)
  origCode = []
  patCode = []
  for p in patCodon:
      for d in dna:
           if d == p:
                x = dna[p]
                print (p)
                patCode.append(x)
  </code></pre>
  
  <p>The code above takes two lists and splits them into groups of three, but when I go to check each individual element, it makes a new list of three, moving along one element each time.</p>
  
  <p>i.e. this is one list made:</p>
  
  <pre><code>['AAC', 'ACT', 'CTG', 'TGC', 'GCA', 'CAG', 'AGC', 'GCT', 'CTC', 'TCA']
  </code></pre>
  
  <p>But these are the elements it checks:</p>
  
  <pre><code>AAC
  ACT
  CTG
  TGC
  GCA
  CAG
  AGC
  GCT
  CTC
  TCA
  </code></pre>
  
  <p>How do I make it so that each group of three is checked and then it moves on to the next?</p>
  
  <p>My list is split into groups of three (becoming items in the list), I want to check each of those items for their corresponding amino acid (in a dictionary), but the  program keeps making new lists, e.g. the user enters AAATTT, then the program checks:</p>
  
  <pre><code>AAA
  AAT
  ATT
  TTT
  </code></pre>
  
  <p>rather than just AAA and TTT</p>