title: How to control the number of loops with user input?
body: <p>My question is: how I can define an input code that the user can be entered for example 3, 5, 6, or any number to get an output with 3 letters,  5 letters and etc(according to user input).</p>
  <p>Output for this code is:</p>
  <pre class="lang-none prettyprint-override"><code>TC:2,
  CG:2,
  AT:3,
  GC:1,
  CA:1,
  GA:1,
  </code></pre>
  <p>Code:</p>
  <pre><code>dna = &quot;ATCGCATCGAT&quot;
  bases = ['A', 'C', 'G', 'T']
  all_counts = {}
  for base1 in bases:
      for base2 in bases:
          dinucleotide = base1 + base2
          count = dna.count(dinucleotide)
          if count &gt; 0:
              all_counts[dinucleotide] = count
  for key, value in all_counts.items():
      print(key, ':', value)
  </code></pre>
  <p>If the user entered 3, that code will be change like:<br />
  output for number 3 is:</p>
  <pre><code>ATC : 2,
  CAT : 1,
  CGA : 1,
  CGC : 1,
  GAT : 1,
  GCA : 1,
  TCG : 2,  
  </code></pre>
  <pre><code>dna = &quot;ATCGCATCGAT&quot;
  bases = ['A', 'C', 'G', 'T']
  all_counts = {}
  for base1 in bases:
      for base2 in bases:
          for base3 in bases:
              dinucleotide = base1 + base2 + base3
              count = dna.count(dinucleotide)
              if count &gt; 0:
                  all_counts[dinucleotide] = count
  for key, value in all_counts.items():
      print(key, ':', value)
  </code></pre>
  <p>So, my question is:<br />
  How with user input, we can control or add a new loop to this code?<br />
  For example, if user entered 4, the program added a new loop automatically by splitting the letter in 4 with this output:</p>
  <pre><code>ATCG : 2,
  CATC : 1,
  CGAT : 1,
  CGCA : 1,
  GCAT : 1,
  TCGA : 1,
  TCGC : 1,  
  </code></pre>