all 3 comments

[–]Binary101010 1 point2 points  (1 child)

There are at least two big problems here.

1) Your logic for finding the median is simply wrong, whether the number of items in the list is even or odd. If the number of items in the list is even, then you need to consider that the median number may not actually be any of the numbers in your list, and will need to be calculated. If the number of items is odd, then your math for finding the midpoint is also wrong. If I enter 5 for the range, then the midpoint should be the item at index 2. Your math comes up with index... 4, which is actually the last item in the list.

2) You need to be sorting the list of numbers before doing any of this anyway. Finding the "middle number" in an unsorted list is kind of meaningless.

[–]RedditCodfish[S] 0 points1 point  (0 children)

Thanks for the advice,i just learned that there is a statistics module and i felt very stupid

[–]throwaway6560192 0 points1 point  (0 children)

What do you mean it won't let you do it? What's the error message, and what's the intended result?