Spaces:
Runtime error
Runtime error
<<<<<<< HEAD | |
class ValueWindow(): | |
def __init__(self, window_size=100): | |
self._window_size = window_size | |
self._values = [] | |
def append(self, x): | |
self._values = self._values[-(self._window_size - 1):] + [x] | |
def sum(self): | |
return sum(self._values) | |
def count(self): | |
return len(self._values) | |
def average(self): | |
return self.sum / max(1, self.count) | |
def reset(self): | |
======= | |
class ValueWindow(): | |
def __init__(self, window_size=100): | |
self._window_size = window_size | |
self._values = [] | |
def append(self, x): | |
self._values = self._values[-(self._window_size - 1):] + [x] | |
def sum(self): | |
return sum(self._values) | |
def count(self): | |
return len(self._values) | |
def average(self): | |
return self.sum / max(1, self.count) | |
def reset(self): | |
>>>>>>> 5c2a04960e1c0e71007f0b0776154103fc0df460 | |
self._values = [] |