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