0
Why always for loops are used with Generators in python
2 Respostas
+ 1
You don't always have to use for loop with generators:
def g():
yield 1
yield 2
yield 3
a = g()
print(next(a))
print(next(a))
print(next(a))
0
Seb TheS Well bruh can't we utilize the general within the print statement like this: print(g()) and also this give the name of the function/generator