I am trying to change something in every second element of my array. In that element then I only want to modify the 5th element (it's an array of arrays). I want to do so by just having a step of 2 in my while-loop. Therefore I added i += 2.
Now it's weird:
when I put only in:
PaylikeTableWithFee[i] = 'hello'
Then it works and only every second array is modified and set to 'hello'.
However when I do so:
PaylikeTableWithFee[i][5] = 'hello'
Then every array is modified although the loop has a step of 2.
i = 1
while i < len(PaylikeTableWithFee):
PaylikeTableWithFee[i][5] = 'hello'
i += 2
Normally only the 5th element of every 2th array inside the main-array should be edited.
PaylikeTableWithFee? An array? An in that case an array of what?arr[1::2]PaylikeTableWithFeebecause that is probably where the problem is. If I define it likePaylikeTableWithFee = [[0] * 6,[0] * 6,[0] * 6,[0] * 6,[0] * 6]only the fith element in every second element is changed, just as you want.