This commit is contained in:
2024-09-13 18:58:59 +02:00
parent 64ba3fe295
commit 69d21bf28e
2 changed files with 7 additions and 1 deletions

View File

@ -0,0 +1,6 @@
# Generators
# Generators are very easy to implement, but a bit difficult to understand.
# Generators are used to create iterators, but with a different approach. Generators are simple functions which return an iterable set of items, one at a time, in a special way.
# When an iteration over a set of item starts using the for statement, the generator is run. Once the generator's function code reaches a "yield" statement, the generator yields its execution back to the for loop, returning a new value from the set. The generator function can generate as many values (possibly infinite) as it wants, yielding each one in its turn.
# Here is a simple example of a generator function which returns 7 random integers:

View File

@ -1 +1 @@
This project is based on the https://www.learnpython.org/ python tutorial.
This project is based on the https://www.learnpython.org/ python tutorialseries.