I'm working through a tutorial which includes this code:
for position, target in population_gen(population):
pos = float(position)
all_inputs.append([random.random(), pos * factor])
all_targets.append([target])
I don't fully understand how the for
loop works. In particular: what is the loop iterating through exactly? I'm only familiar with simple examples like for i in mylist:
. How can there be a function call on the right-hand side of in
, and two things separated by a comma on the left-hand side?