title: Function with nested WHILE loop producing unexpected results
body: <p>I am learning python in college, and have been having trouble with some concepts, mainly loops. I need help understanding why my code is producing an incorrect result:</p>
  
  <pre><code>def fibonacci(maxint):
      a, b = 0, 1
      LIST = [a, b]
      while b &lt; maxint:
          a, b = b, a + b
          LIST.append(b)
      return LIST
  </code></pre>
  
  <p>In order to test the script, I need to call the function and pass 10 as an argument in the console:</p>
  
  <pre><code>&gt;&gt;&gt;fibonacci(10)
  </code></pre>
  
  <p>The output should show as:</p>
  
  <pre><code>[0, 1, 1, 2, 3, 5, 8]
  </code></pre>
  
  <p>but it is actually printing:</p>
  
  <pre><code>[0, 1, 1, 2, 3, 5, 8, 13]
  </code></pre>
  
  <p>Can someone please analyze my code and tell me the following:</p>
  
  <ol>
  <li>where is it inefficient?</li>
  <li>Why is it going out of bounds and looping past 10 (the argument from my function)?</li>
  </ol>