Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python generator

def count_to_ten_generator():
  for number in range(10):
    yield number
my_generator = count_to_ten_generator()
first_number = next(my_generator)
list_or_the_rest = list(my_generator)
 
PREVIOUS NEXT
Tagged: #python #generator
ADD COMMENT
Topic
Name
9+1 =