Fibonacci sequence using list in PYTHON?

fibonacci, list, python

Solution

This code puts the first 700 fibonacci numbers in a list. Using meaningful variable names helps improve readability!

fibonacci_numbers = [0, 1]
for i in range(2,700):
    fibonacci_numbers.append(fibonacci_numbers[i-1]+fibonacci_numbers[i-2])

Note: If you're using Python < 3, use `xrange` instead of `range`.

Problem

I have a problem about making a fibonacci sequence to a list, I'm just new to python someone help me please. This is my code. I know this is looking wrong or something because it says invalid syntax. I don't know what to do about this really :( This code works for a normal code without using a list! ``` myArray1 = [0] myArray2 = [1] while myArray2 < 700: myArray1, myArray2 = b[i], myArray1+myArray2[i] print(myArray2) ```

Original source