Python has a feature called a generator — it’s a way of writing a function that allows that function to trade control back and forth with a calling function. It’s not something one needs often, but it can be very useful in certain situations.
Create a Python generator, firstly, in using yield instead of return and, secondly, by designing the function a little differently from one that generates and then returns a list of items.