I have a problem with creating a Fibonacci sequence in a list, I'm just new to python, please Please help please
This is my code. I know that it looks wrong or something because it says invalid syntax, I do not know what to do about it really: (
< P> This code works for the normal code without a list! myArray1 = [0] myArray2 = [1] while myArray2 & lt; 700: myArray1, myArray2 = b [i], myArray1 + myArray2 [i] print (myArray2)
You may need to brush your dragon basics, it's a lot of nonsense in your code. It is being said that this code puts 700 fibonacci numbers on the list (you should use meaningful variables! Name)
fibonacci_numbers = [0, 1] For the range of (2700): fibonacci_numbers.append (fibonacci_numbers [i-1] + fibonacci_numbers [i-2])
Note: If you use Python & lt; 3, then use xrange
instead of category
.
Comments
Post a Comment