@RyanMarcus/

generator state

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
def generator_example():
  for i in range(10):
    yield i

g = generator_example()

for i in g:
  print("first loop", i)

for i in g: 
  print("second loop", i)

print("---------------------------")

for i in generator_example():
  print("first loop", i)

for i in generator_example(): 
  print("second loop", i)