If the function produces the correct median for
lists that contain odd as well as those that contain even numbers of elements, it is correct in that regard. You can test it with various examples to verify whether that is true.
Another issue is whether the function leaves the
list that it is passed in its original unsorted form. It is true that you should perform a sort within the function, however, it is best for a function to leave the original object intact, unless one of the purposes of the function is to change that object.
Try this …
grades = [94, 95, 97, 96, 93]
Does calling the function change the order of the elements in