def back_prop(net, target):
    back_len = len(net)
    for i in range(back_len):
        ind = ((back_len - i) - 1)
        layer = net[ind]
        errors = []
        if (ind == (back_len - 1)):
            j = 0
            for neuron in layer:
                errors.append((target[j] - neuron.output))
                j += 1
        else:
            for j in range(len(layer)):
                error = 0.0
                for neuron in net[(ind + 1)]:
                    error += (neuron.weights[j] * neuron.delta)
                errors.append(error)
        j = 0
        for neuron in layer:
            neuron.delta = (errors[j] * neuron.dfunc(neuron.output))
            j += 1
    return net
def back_prop(net, target):
    back_len = len(net)
    for i in range(back_len):
        ind = ((back_len - i) - 1)
        layer = net[ind]
        errors = []
        if (ind == (back_len - 1)):
            j = 0
            for neuron in layer:
                errors.append((target[j] - neuron.output))
                j += 1
        else:
            for j in range(len(layer)):
                error = 0.0
                for neuron in net[(ind + 1)]:
                    error += (neuron.weights[j] * neuron.delta)
                errors.append(error)
        j = 0
        for neuron in layer:
            neuron.delta = (errors[j] * neuron.dfunc(neuron.output))
            j += 1
    return net