new = []
curvepoints = []
for i in range (0, 10):
for j in range (0, 3):
new.append(0)
curvepoints.append(new)
new = []
I have initialized my main array curvepoints
using the above code
p = [-30, -23, -16, -9, -2, 5, 12, 19, 30]
p
is my 2nd array. I am trying to initialize every 1st element of curvepoint
with element of p
using the below code
for i in range(0,len(p)):
print(curvepoints[c][0])
curvepoints[c][0]=p[i]
c = c+1
But it is initializing abruptly as follows:
[[-16, 0, 0], [-16, 0, 0], [-16, 0, 0], [5, 0, 0], [5, 0, 0], [5, 0, 0], [30, 0, 0], [30, 0, 0], [30, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]
Please do let me know how I can initialize only the 1st elements with p
.