title: Getting error in python when trying to print a variable from a class' function
body: <pre><code> class Network(object):
  
          def __init__(self, sizes):
  
          def feedforward(self, a):
              for b, w in zip(self.biases, self.weights):
                  a = sigmoid(np.dot(w, a)+b)
              return a
  
          def SGD(self, training_data, epochs, mini_batch_size, eta,
                  test_data=None):
  
          def evaluate(self, test_data):
              test_results = [(np.argmax(self.feedforward(x)), y)
                              for (x, y) in test_data]
              return sum(int(x == y) for (x, y) in test_results)
  
      def sigmoid(z):
          return 1.0/(1.0+np.exp(-z))
  </code></pre>
  
  <p>I'm making a neural network (I've left out a lot of code of course because there is a lot of it) and in the function "feedforward" I have the variable "a" which return the activation functions. Once the training is over I would like to print out that variable. 
  The training is started by this:</p>
  
  <pre><code>net=Network([784,30,10])
  net.SGD(training_data, 5, 30, 3.0, test_data=test_data)
  </code></pre>
  
  <p>and the code I tried to print out a:</p>
  
  <pre><code>print(net.feedforward(a))
  </code></pre>
  
  <p>But I get the following error:</p>
  
  <pre><code>`Traceback (most recent call last):
    File "&lt;input&gt;", line 1, in &lt;module&gt;
    File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.3\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
      pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
    File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.3\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
      exec(compile(contents+"\n", file, 'exec'), glob, loc)
    File "C:/Users/MyName/DeepLearningPython35/network.py", line 158, in &lt;module&gt;
      print(net.feedforward(a))
  NameError: name 'a' is not defined`
  </code></pre>