Median Bug


There is a problem with the checking program!
When I submit they say that when List [4,5,5,4] is entered 5.0 is returned and not 4.5, however, the median of this list is 5.0 because the centre two entries are 5 and 5 thus the median will be 5, because it is the average between 5 and 5.

I can't find the link to submitting bugs, thus I have started a topic, hopefully, this can be fixed so that I can continue!


no, there is not.

the median is the two center entries of a sorted list, so after sorting you have:


two middle values are 4 and 5, which makes the median 4.5


Thanks, forgot the sorting !


The median of [4,5,5,4] is actually 4.5. The list should be sorted first, before we look for what is in the middle.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.