generator.py 86 Bytes
Newer Older
Mareš Martin's avatar
Mareš Martin committed
1
2
3
4
5
6
def gen(n):
    for i in range(n):
        yield i**2

for x in gen(10):
    print(x)