The time()
method returns the elapsed seconds since the epoch as a float. In order to print out the elapsed time in seconds from a particular start time, you need to set your start_time = time.time()
. Then you can take the difference of time.time() - start_time
to get the elapsed time in seconds.
As for why your function isn't outputting the median, I would first make sure that you are passing quickSelect
a list of integers. Right now, it appears that you are passing a list of strings, so your comparisons in quickSelect
are between pairs of strings instead of integers. Try using
L.append( int(locations) )