title: I wrote a code for quicksort. But I don't know why this is occurring NameError?
body: <p>I wrote this code for quicksort.</p>
  
  <pre><code>def partition(a,start = 0,end = len(a)-1):
      pivot = a[0]
      while start&lt;end:
          while a[start]&lt;=pivot:
              start+=1
          while a[end]&gt;pivot:
              end-=1
          a[start],a[end] = a[end],a[start]
      pivot,a[end] = a[end],pivot
      return end
  
  def quicksort(a,lb =0,ub =len(a)-1):
      if lb&lt;ub:
          loc = partition(a,lb,ub)
          quicksort(a,lb,loc-1)
          quicksort(a,loc+1,ub)
  
  A = [3,5,1,7,9,6,2]
  
  B = quicksort(A)
  
  print(B)
  </code></pre>
  
  <p>I don't know why this is occuring NameError. a is a parameter of the function. Till its giving error.</p>
  
  <pre><code>Traceback (most recent call last):
    File "/data/data/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in &lt;module&gt;
      start(fakepyfile,mainpyfile)
    File "/data/data/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
      exec(open(mainpyfile).read(),  __main__.__dict__)
    File "&lt;string&gt;", line 1, in &lt;module&gt;
  NameError: name 'a' is not defined
  </code></pre>
  
  <p>[Program finished]</p>