Чэнь Сюаньдун, 619/2 группа DefCounter 12126
Абдул Гани Надим, 634 DefCounter 12123
f1from collections import Counterf1from collections import Counter
22
3class DefCounter(Counter):3class DefCounter(Counter):
44
n5    def __init__(self, iterable=None, **args):n5    def __init__(self, iterable=None, **kwds):
6        self.missing = args.pop('missing', -1)6        self.missing = kwds.pop('missing', -1)
7        super().__init__(iterable, **args)7        super().__init__(iterable, **kwds)
88
9    def __getitem__(self, key):9    def __getitem__(self, key):
10        return self.get(key, self.missing)10        return self.get(key, self.missing)
1111
12    def __abs__(self):12    def __abs__(self):
t13        return sum((value for value in self.values() if value > 0))t13        return sum((v for v in self.values() if v > 0))
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op