Yield Statement and Generator Functions in Python
I recently discovered
yield statement in python and how it can be used to create generator functions. To understand
yield first we need to understand the generator function.
Generator function in Python
Generators are special functions in Python that instead of returning a single value or a list of values, return an object called…