This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author leonardo.simunovic@gmail.com
Recipients leonardo.simunovic@gmail.com, terry.reedy
Date 2019-12-22.11:45:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1577015139.29.0.995275157746.issue39118@roundup.psfhosted.org>
In-reply-to
Content
in this code the variable o changes on its own:

x=[[-1, 7, 3], [12, 2, -13], [14, 18, -8], [17, 4, -4]]
x1=[[-8, -10, 0], [5, 5, 10], [2, -7, 3], [9, -8, -3]]
y=[[0,0,0],[0,0,0],[0,0,0],[0,0,0]]
k=True
f=0
z=[]
d=[]
while k:
    print(k)
    o=x
    print(o)
    for i in range(len(x)):
        for n in range(len(x)):
            if i!=n:
                for g in range(3):
                    if x[i][g]>x[n][g]:
                        y[i][g]-=1
                    if x[i][g]<x[n][g]:
                        y[i][g]+=1
    for i in range(len(x)):
        for n in range(3):
            x[i][n]+=y[i][n]
    for i in range(len(z)):
        if z[i]==x and d[i]==y:
            print("")   
    print(o)
    k=False


A similar error happens when I try to append x values to a list, the list is filled with the same x value (the last one that has been appended) the number of times a x value had been appended in general.

For example:

if I had a values of x at the end of the while loop as 1, 2 and 3 and I appended them to a list the list would be [3, 3, 3] instead of [1, 2, 3]. If i wrote the list out each time a new x value is appended it would write it [1] first, then [2, 2] and then [3, 3, 3] at the end. 

I am really sorry for wasting time if this is just me being really dumb and messing something up.
History
Date User Action Args
2019-12-22 11:45:39leonardo.simunovic@gmail.comsetrecipients: + leonardo.simunovic@gmail.com, terry.reedy
2019-12-22 11:45:39leonardo.simunovic@gmail.comsetmessageid: <1577015139.29.0.995275157746.issue39118@roundup.psfhosted.org>
2019-12-22 11:45:39leonardo.simunovic@gmail.comlinkissue39118 messages
2019-12-22 11:45:38leonardo.simunovic@gmail.comcreate