I'm trying to create a multidimensional list from a loop, but something is making all the column values change simultaneously when entering a new value for a row and column causing only the last value to be preserved. I know it has something to do with how i initialize the list, but am unsure on how to fix it.
code:
sellorderprices = ["Sellorderprice", 0, 1, 2, 3, 4, 5]
buyorderprices=["Buyorderprice", 10, 11, 21, 31, 41, 51]
days=["Days",150, 120, 90, 60, 30, 0]
export_data=[[None]*3]*(len(days))
for n in range (0, len(export_data)):
export_data[n][0]=days[n]
export_data[n][1]=buyorderprices[n]
export_data[n][2]=sellorderprices[n]
print(export_data)
this prints [[0, 51, 5], [0, 51, 5], [0, 51, 5], [0, 51, 5], [0, 51, 5], [0, 51, 5], [0, 51, 5]]