Here is my code to generate values in the fibonnacci sequence below 10,000,000.
3 fibs = [1,1] 4 while((x = fibs[-1] + fibs[-2]) <= 10000000): 5
In Python, assignment is not an expression, and therefore has no value.
The simplest solution is to do the assignment in the first part of the loop:
fibs=[1,1] while fibs[-1] <= 10000000: fibs.append(fibs[-1] + fibs[-2])