Могиленец Виктор, Севастополь DefCounter 12195
Гадиева Тамара, 523 группа DefCounter 12998
f1from collections import Counterf1from collections import Counter
22
3class DefCounter(Counter):3class DefCounter(Counter):
44
n5    def __init__(self, collect, missing=-1):n5    def __init__(self, data, missing=-1):
6        super().__init__(collect)6        super().__init__(data)
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        mod = 0t13        sum = 0
14        for elem, count in self.items():14        for key, value in self.items():
15            if count > 0:15            if value > 0:
16                mod += count16                sum += value
17        return mod17        return sum
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op