In this, the calling scope the data is unsorted. it might be necessary to retain order of the data in the original sample list so we would not want our function to modify its order. An in-place sort in the function will take place on the caller object so its original order will be lost.
Thank you mtf! This is all extremely helpful, I am still however experiencing an error when i enter a list containing only the value 1. Do you know why this is? A normal list containing multiple values works correctly
And here is the Error I am receiving: “IndexError : list index out of range”
this kind of makes sense since the formulas for high & low will not = 0 (the index of a single value). However I also included an if statement that said:
if count == 1:
low = 0
and I still received the error, this is confusing since 1 % 2 == 0: is false, so it should go to the else statement and return index 0