title: Passing a function as an argument inside another function
body: <pre><code>def pivot2(arr,start=0,end=len(arr)):
      pivot=arr[start]
      swapid=start
      for x in range(start+1,end):
          if(pivot&gt;arr[x]):
              swapid +=1
              swap(arr,swapid,x)
              print(arr)
      swap(arr,start,swapid)
      return swapid
  
  def swap(arr,i,j):
      temp=arr[i]
      arr[i]=arr[j]
      arr[j]=temp
  </code></pre>
  <p>In <code>pivot2</code> function I get an error that <code>arr name not defined</code> and when I remove <code>end=len(arr)</code> from the arguments the function works, why can't I pass <code>len(arr)</code> as an argument in Python?</p>