Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
The expression specifies for the generator. Here it is the simplest and looks like a tautology, but not always the same:
[x**2 for x in range(1, 1000)]
the same thing without a generator, you can somehow write like this.
i = []
for x in range(1,1000):
i.append(x)
Before for, what is added to the list is not necessarily even a temporary variable from the loop, it can be anything, even though the constant number 1 and after each iteration the number 1 will be added to the list.
And after you have entered what will be added to the list, you enter the cycle itself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question