I've got a question about iteration in python. At the moment I am trying to build a very simple neural net, using the following (parts of the) code:
class neural_net:
    def __init__(self, n_neurons, n_input):
        self.n_neurons = n_neurons
        self.n_input = n_input
        self.input = []
        self.weights = []
        self.output = []
    def generate_input(self):
        input = [0.0,0.0,1.0]
        self.input = input
    def generate_random_weights(self):
        weights = [[0] * self.n_input ] * (self.n_neurons)
        for i in range(self.n_neurons):
            for ii in range(self.n_input):
                weights[i][ii] =  round(random.random(), 1)
        self.weights = weights
In the function generate_random_weights, i=0 and i=1 are always updates at the same time. The result is always something like the following when a print it, using print'weights:', self.weights:
weights: [[0.2, 0,1, 0,8], [0,2, 0,1, 0,8]]
The first and the second list are always the same: does anyone know why this happens?
 
     
    