[ create a new paste ] login | about

Link: http://codepad.org/478kCRFE    [ raw code | output | fork ]

xavieran - Python, pasted on Apr 19:
1
2
3
4
5
6
7
8
9
def generate_x():
    i = 0
    while i < 10:
        print i
        yield i
        i += 1

for x in generate_x():
    print x


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
0
0
1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9


Create a new paste based on this one


Comments: