forAdvanced Playground

Starts a loop that iterates over a sequence or iterable

Python Playground
Output
Click "Run" to execute your code

Implementing __iter__ as a generator makes your class iterable. Using yield means each FibSequence can be iterated independently.

Challenge

Try modifying the code above to explore different behaviors. Can you extend the example to handle a new use case?