variance += (n - mean) ** 2
for n in self.highers:
variance += (n - mean) ** 2
- count = len(self.lowers) + len(self.highers) - 1
+ count = len(self.lowers) + len(self.highers)
return math.sqrt(variance) / count
def _create_sorted_copy_if_needed(self, count: int):
self._create_sorted_copy_if_needed(count)
assert self.sorted_copy
index = round(count * (n / 100.0))
- assert 0 <= index < count
+ index = max(0, index)
+ index = min(count - 1, index)
return self.sorted_copy[index]