Changing a variable in a list does not affect the list
Question: I've been attempting to write some code to tune variables in my chess program,
and I found that this code doesn't do what I expect it to do at all.

    
    
    import random
    
    # Knight value, bishop value, rook value, queen value
    values = [300, 300, 500, 900]
    
    e1vals = values
    e2vals = values    
    
    # Add a gaussian distributed random number to it
    deltas = []
    for i in range(0, len(values)):
        x = random.gauss(0, 20)
        deltas.append(x)
    
    for i in range(0, len(values)):
        e1vals[i] = values[i] + deltas[i]
        e2vals[i] = values[i] - deltas[i]
    
    print(e1vals)
    print(e2vals)
    

Intuitively, the code here should simply add or subtract the values in deltas
to e1vals and e2vals, but instead it doesn't make any change other than
casting values to float.

I'm using Python 3.5.1 if that makes any difference.


Answer: The problem is that `e1values` and `e2values` refer to the _same_ list. So all
your code does is add a value to each item in the list, then subtract it
again, leaving you with the original value.

