title: Basic DNA Coding Exercise
body: <p>I recently failed an interview in which I was thrown a Python coding question out of the blue. I'm currently learning Python, and if I came upon the same question again or a similar question I want to be able to answer it.</p>
  <p>The question was as follows:</p>
  <blockquote>
  <p>Write a function which takes as its input a string containing the letters: [A, C, G, T]; and outputs all the 3-letter subsequences found in the input and the frequency with which they occur.
  For example, if the input string was &quot;ACTACTTAC&quot;, the output would be something like:</p>
  <pre class="lang-none prettyprint-override"><code>ACT: 2
  CTA: 1
  TAC: 2
  CTT: 1
  TTA: 1
  </code></pre>
  </blockquote>
  <p>I came up with some ideas after the fact and I had wondered if a solution like this works, or is there a better way of doing it?</p>
  <pre class="lang-py prettyprint-override"><code>def Determine_DNA(dna_list):
      n = len(dna_list[0])
      A = [0]*n
      T = [0]*n
      G = [0]*n
      C = [0]*n
      for dna in dna_list:
          for index, base in enumerate(dna):
              if base == 'A':
                  A[index] += 1
              elif base == 'C':
                  C[index] += 1
              elif base == 'G':
                  G[index] += 1
              elif base == 'T':
                  T[index] += 1
      return A, C, G, T
  </code></pre>