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