title: Project Euler 2: The right answer, but something bothering me in the code
body: <pre><code># Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
  # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
  # By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
  
  fibon = [1, 2] # The first 2 numbers in the sequence
  addtoend = 0 # The number that will be added to the end of the sequence
  evens = [] # Will hold the even numbers in the sequence
  
  while fibon[-1] &lt;= 4000000: # Starts the While loop
      addtoend = fibon[-1] + fibon[-2] # Sets addtoend equal to the last two items in fibon[]
      fibon.append(addtoend) # Appends addtoend onto the end of fibon[]
  
  print fibon # Print out fibon[]
  
  for i in fibon: # Starts the for loop
      if i % 2 == 0: # If the remainder of the current item in the list when divided by 2 is 0...
          evens.append(i) # Then add it to the evens[] list
      else: # Otherwise...
          pass # Just skip it
  
  print evens # Print the evens array, with all the even numbers from fibon[] inside it.
  print sum(evens) # Print the sum of all the even numbers from evens[]
  </code></pre>
  
  <p>This gives the result:</p>
  
  <pre><code>[1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887]
  [2, 8, 34, 144, 610, 2584, 10946, 46368, 196418, 832040, 3524578]
  4613732
  </code></pre>
  
  <p>I checked the answer on project Euler, and it was correct, which is good :D But one thing I'm not sure about, is when it prints out the list of numbers in the sequence, it has the number: <strong>5702887</strong> on the end. This is over the 4 million of the loop, and while it doesn't affect the overall answer, I'm confused as to how it's there.</p>
  
  <p>Thanks in advance :D</p>