title: Printing all possible combinations using recursion
body: <p>I'm trying to write a Python program that outputs all possible strings formed by using
  the characters <code>c, a, t, d, o</code> and <code>g</code> exactly once using recursion only.</p>
  
  <p>so far I've got this:</p>
  
  <pre><code>i = ['c', 'a', 't', 'd', 'o', 'g']
  
  counter = 0
  def func(i):
  
      global counter
  
      i[counter], i[counter+1] = i[counter+1], i[counter]
      print(i)
  
      if counter != 5:
          counter += 1
          return func(i)
  
  func(i)
  </code></pre>
  
  <p>EDIT: 
  sorry for being "impolite", but I just copy-pasted the exercise from the book. This is just a pure text from the book.</p>