'Class property not defined

a = input("Enter synaptic input strength: ")
infile = [a]
i = 0
elements = []

class Neuron:
    def __init__(self, f, inputN):
        self.f = f
        self.inputN = inputN
    
    isNeuron = "true" 
    def inpadd(self, inp):
        elements = []
        elements.append(inp)
        for element in range(len(inputN)):
            elements.append(element)
            elements.append(element)

N1 = Neuron("Sum", infile)
Nlist = []
Nlist.append(N1)
for item in range(len(Nlist)):
    for element in range(len(infile)):
         name = Nlist[i]
         name.inpadd(infile[i])
         print(item.elements)
         i = i + 1

I'm attempting to create the start of a program that will simulate a collection of neurons. I have a class property elements[] which I append the input to before eventually processing it in a master function which modifies the inputs (summing them, multiplying them) based on the type of Neuron. Unfortunately, every time I run the program I get the error message

  Traceback (most recent call last):
  File "<string>", line 25, in <module>
  File "<string>", line 15, in inpadd
  NameError: name 'inputN' is not defined

Which inplies that the inputN variable is not defined. Is there something wrong with the scope of the variables or does the problem lie elsewhere?

Thanks in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source