title: Python- Quickselect function finding the median
body: <p>So I have developed the code for a quick select function but it doesn't seem to be printing out the median.
  I have the main function prompt for a file name and then import that txt file, split it up into a list of numerals this is the txt file:</p>
  
  <pre><code>Offices 70
  MedicalOffice  120
  PostOffice 170
  Mall 200
  </code></pre>
  
  <p>It gets imported into a list:</p>
  
  <pre><code>L = ['70', '120', '170', '200']
  </code></pre>
  
  <p>when it runs through the quickselect function it prints out the elapsed time being an odd number that changes every time something like 1.9083486328125e-06... first off what value of time is this in milliseconds? and when the function runs and returns the pivot it spits out this:</p>
  
  <pre><code>&gt;&gt;&gt; main()
  Enter a filename: Input.txt
  ['70', '120', '170', '200']
  Time:  1.9073486328125e-06
  200
  </code></pre>
  
  <p>Can someone tell me why it isn't working? this is the code:</p>
  
  <pre><code>import time
  
  start_time = 0
  
  def quickSelect(L, k):
     start_time = time.time() 
     if len(L) != 0:
        pivot = L[(len(L)//2)]
        smallerList = []
     for i in L:
          if i&lt;pivot:
             smallerList.append(i)
     largerList=[]
     for i in L:
          if i&gt;pivot:
             largerList.append(i)
     m=len(smallerList)
     count=len(L)-len(smallerList)-len(largerList)
     if k &gt;= m and k &lt; m + count:
         end_time = time.time()
         print("Time: ", end_time - start_time)
         return pivot
     elif m &gt; k:
          return quickSelect(smallerList, k)
     else:
         return quickSelect(largerList, k - m - count)
  def main():
  
      dataFilename = input('Enter a filename: ')
  
      dataFile = open(dataFilename)
      L = []
      for inputLine in dataFile:
          splittext = inputLine.split()
          place = splittext[0]
          locations = splittext[1]
          L += [locations]
      print(L)
      print(quickSelect(L, len(L)//2))   
  </code></pre>