If I have a list of numbers, and I want to increment them using a for loop, why isn\'t this working:
>>> list=[1,2,3,4,5] >>> for num in l
You can achieve this by indexing the array.
>>> list=[1,2,3,4,5] >>> for i in range(len(list)): ... list[i]=list[i]+1
This will circumvent the referencing issue Lattyware spoke of.