Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class FibonacciIterator:
- def __init__(self, max):
- self.max = max
- def __iter__(self):
- return self
- def __next__(self):
- fib = self.x
- if fib > self.max:
- raise StopIteration
- self.x, self.y = self.y, self.x + self.y
- return fib
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement