I have tried many things but still stuck. This is mostly because I'm failing to understand how python loops through an array or what options I have to loop through it.
I want to build an array: 4 columns, 18 rows.
I need the first column of each row to be a persons name in the person_list. Every 3 rows of my array I would then increment to the next person.
It would seem that my loop is not looping through the array the way I intended. It seems that it sets all values in the first column equal to the person_list value.
person_list = ["person1", "person2","person3","person4","person5","person6"]
my_array = [[0]*4]*len(person_list)*3
i=0
j=1
for row in my_array:
while j <= 3:
row[0] = person_list[i]
j+=1
j=1
i+=1
So the goal would be the resulting array
[
["person1", 0, 0, 0],
["person1", 0, 0, 0],
["person1", 0, 0, 0],
["person2", 0, 0, 0],
["person2", 0, 0, 0],
["person2", 0, 0, 0],
["person3", 0, 0, 0],
["person3", 0, 0, 0],
...
]