Example & Tutorial understanding programming in easy ways.

What is the Python Generator ?

A Generator is a kind of function which lets us specify a function that acts like an iterator and hence can get used in a "for" loop.


-We use yield keyword in generator instead using of return

program:

def g():

    yield "It is a generator"

print(next(g()))

// output is It is generator

Read More →