In 20 for in range In 21 In 22 for in if break In 24 list Out 24

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
In [20]: g = (x for x in range(5))
In [21]: i=0
In [22]: for _ in g:
if i == 3: break
....: i+=1
....:
In [24]: list(g)
Out[24]: [4]