What I would recommend doing here is the following as it puts this into one function and is quite fast depending on how far you go
Note there are still more efficient ways to do this using generators but that is becoming quite complex
def getFibonacciNumber(requested, returnAll=False):
'''
This is used to collect a certain index of the fibonacci
sequence. If asked this can also return all numbers
up to a certain position
'''
values = dict()
for index in range(1, requested + 1):
previousFirst = values.get(index - 2, 0)
previousSecond = values.get(index -1, index)
current = previousFirst + previousSecond
values[index] = current
if returnAll:
return values.values()
return values.get(requested)
# This will get you the 100th number
print getFibonacciNumber(100)
# This will get you all numbers up to the 100th
print getFibonacciNumber(100, returnAll=True)
Hope that can help
Cheers!