title: What does the error "Name Error: name is not defined" mean in this code
body: <p>Consider the following code:</p>
  
  <pre><code>def distancias(altitudes,lado,p1,p2):
      p1=(r1,c1)
      p2=(r2,c2)
      a1=altitudes[p1]
      a2=altitudes[p2]
      d=math.sqrt((lado(r1-r2)**2)+(lado(c1-c2)**2)+(a1-a2)**2)
      return d
  </code></pre>
  
  <p>Altitudes is a matrix and <code>p1</code> and <code>p2</code> are elements of the matrix.</p>
  
  <p>When I call the function <code>distancias(teste, 20, (2, 0), (3, 1))</code>, it is giving me this error:</p>
  
  <pre><code>Traceback (most recent call last):
  
    File "&lt;ipython-input-11-6c6a4bb1ff77&gt;", line 1, in &lt;module&gt;
      distancias(teste, 20, (2, 0), (3, 1))
  
    File "C...", line 5, in distancias
      p1=(r1,c1)
  
  NameError: name 'r1' is not defined
  
      "Name Error: name is not defined".
  </code></pre>
  
  <p>(I want to understand it better as i am new to Python)</p>