I am reading a textbook and I have no idea why is this code compiling differently on my compiler than what it says in the book.
def fibs(number):
result = [0, 1]
for i in range(number-2):
result.append(result[-2] + result[-1])
return result
So this:
fibs(10) should give me [0, 1, 1, 2, 3, 5, 8, 13, 21, 34] but for some reason I get [0, 1, 1] for every number that I pass in to the function.
Any ideas?