title: Python script to create Fibonacci Sequence Generator
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3953749/python-fibonacci-generator">Python Fibonacci Generator</a>  </p>
  </blockquote>
  
  
  
  <p>I am trying to construct a function that can append values to an empty list</p>
  
  <pre><code>n1 = 1
  
  n2 = 2
  
  fn = []
  </code></pre>
  
  <p>I want to add both n1 and n2 together and then send that value to fn.</p>
  
  <p>Then I want to reassign n1 and n2 to the last two values of the sequence.</p>
  
  <p>I then want to be able to stop it after a certain amount of iterations.</p>
  
  <p>I'm basically trying to construct a fibonacci sequence generator without using the function</p>
  
  <pre><code>#s(n) = (1.618^n-(1-1.618)^n)/(5^.5)`
  </code></pre>
  
  <p>Example:</p>
  
  <pre><code> fn = []
  
  
  
  
   def fibb(n1,n2,f_iter):
   # n1 would be the first number of the sequence
   # n2 would be the second number of the sequence
   # f_iter would be how many iterations it would do until finished
  </code></pre>
  
  <p>So if the input was:</p>
  
  <pre><code> def fibb(1,2,10):  
      return fn
  
   fn = [1,2,3,5,8,13,21,34,55,89,144,233]
  
  #f_iter(0:1+2=3,1:2+3=5,2:3+5=8,3:5+8=13, . . . 10:89+144=233)
  </code></pre>