Ли Георгий Феликсович, 525 группа DefCounter 12554
Андреева Елизавета, 522 DefCounter 12384
f1from collections import Counterf1from collections import Counter
22
3class DefCounter(Counter):3class DefCounter(Counter):
44
5    def __init__(self, iterable=None, missing=-1):5    def __init__(self, iterable=None, missing=-1):
6        super().__init__(iterable)6        super().__init__(iterable)
7        self.missing = missing7        self.missing = missing
88
9    def __missing__(self, key):9    def __missing__(self, key):
10        return self.missing10        return self.missing
1111
12    def __abs__(self):12    def __abs__(self):
t13        positive_sum = 0t13        s = 0
14        for count in self.values():14        for i in self.values():
15            if count > 0:15            if i > 0:
16                positive_sum += count16                s += i
17        return positive_sum17        return s
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op