

Python iterator and scope
An iterator is an object that contains a countable number of values.
which can be iterated upon, meaning that you can traverse through all the values.
Lists, tuples, dictionaries, and sets are all iterable objects.
All these objects have a iter() method which is used to get an iterator:
To create an object/class as an iterator you have to implement the methods
__iter__() and __next__() to your object.
As you have learned in the Python Classes/Objects chapter, all classes have a function called __init__(), which allows you to do some initializing when the
object is being created.
The __iter__() method acts similar, you can do operations (initializing etc.),
but must always return the iterator object itself.
The __next__() method also allows you to do operations, and must return
the next item in the sequence.
Scope
A variable is only available from inside the region it is created. This is called scope.
A variable created inside a function belongs to the local scope of that function, and
can only be used inside that function.
source
good video
Great job 👍
💪💪
Good
Good