From 69d21bf28e69643ef1d8609bc490c7a4a9894d31 Mon Sep 17 00:00:00 2001 From: Kilokem Date: Fri, 13 Sep 2024 18:58:59 +0200 Subject: [PATCH] ForNow --- AdvancedTutorials/1_Generators.py | 6 ++++++ README.md | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/AdvancedTutorials/1_Generators.py b/AdvancedTutorials/1_Generators.py index e69de29..edbf399 100644 --- a/AdvancedTutorials/1_Generators.py +++ b/AdvancedTutorials/1_Generators.py @@ -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: + diff --git a/README.md b/README.md index f16b06d..f0d4d90 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -This project is based on the https://www.learnpython.org/ python tutorial. \ No newline at end of file +This project is based on the https://www.learnpython.org/ python tutorialseries. \ No newline at end of file