title: Generate a Recursive Tribonacci Sequence in Python
body: <p>I am supposed to create a function to generate a Tribonacci sequence in Python. This function must be <strong>RECURSIVE</strong>. Based on this, I have this code so far:</p>
  
  <pre><code>def TribRec(n) :
      if (n == 0 or n == 1 or n == 2) :
          return []
      elif (n == 3) :
          return [0,1][:n]
      else :
          sequence = TribRec(n-1)
          sequence.append(sequence[len(sequence)-1] + 
          sequence[len(sequence)-2] + sequence[len(sequence)-3])
          return sequence
  
  
  def Trib(n) :
      for i in range(1, n) :
          print( TribRec(i) , " ", end = "")
  
  # Driver code
  n = 10
  Trib(n)
  </code></pre>
  
  <p>When I run this code, I get the following output:</p>
  
  <pre><code>[]  []  [0, 1]  [0, 1, 2]  [0, 1, 2, 3]  [0, 1, 2, 3, 6]  [0, 1, 2, 3, 6, 11]  [0, 1,2, 3, 6, 11, 20]  [0, 1, 2, 3, 6, 11, 20, 37]
  </code></pre>
  
  <p>Instead, I want the output of length = n which is 10 here in the form of:</p>
  
  <pre><code>[0, 1, 2, 3, 6, 11, 20, 37, 68, 125]
  </code></pre>
  
  <p>How do I fix my current code?</p>