repl.it
@charles2588/

PythonGenerator

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
#Generator function yields iterator rather than returning value, no function calls or calls on stack thus saving memory
def f(n):
    for x in range(n):
        yield x**3
for i in f(5):
	print(i)
	
?