Code samples to demonstrate Python iterators and the use of yield statements to create a generator.
Examples based directly on the instruction from Programiz' YouTube Channel
- #28: Iterators in Python | Python for Beginners
- #29: Generators in Python: How to Use them & Why? | Python for Beginners
In the second video, the insturctor summarizes "yield" in the following way:
The difference between yield and return is that the return terminates the function completely while yield pauses the function, saving all it's states for next successive calls