in the range, do you mean the last value provided by the generator? If so, you can do something like this:
def fibonacci(iterations):
# generate your fibonacci numbers here...
[x for x in fibonacci(20)][-1]
This will give you the last generated value.
source
share