I am working on a little project that involves working with and transforming coordinates and my code behaves in a way that I can't explain. Example code:
koord = [[60,10],[70,18],[61,21],[69,11]]
min_X = [255,255]
for i in range(len(koord)):
if koord[i][0]<min_X[0]:
min_X=koord[i]
print(min_X)
for i in range(len(koord)):
for j in range(2):
koord[i][j]=koord[i][j] - min_X[j]
print(min_X)
I expect it to always print [60, 10], but instead I get
[60, 10]
[0, 0]
[0, 0]
[0, 0]
[0, 0]
Why does the min_X
value change? It seams to redo the first for-loop but why?
Can someone explain why this happens and how I can fix it?