title: Python return statement error “ return outside function”
body: <p>When running the following code (in Python 3.6.1) </p>
  
  <pre><code>def compute_cost(X, y, theta):
   m = y.size #Nombre des exemples de l'apprentissage
   predictions = X.dot(theta)
   sqErrors = (predictions - y)
   J = (1.0 / (2 * m)) * sqErrors.T.dot(sqErrors)
  return J
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>SyntaxError: 'return' outside function
  </code></pre>
  
  <p>Any help would be appreciated. Thanks!</p>