|
|
|
|
|
by avyfain
3585 days ago
|
|
Yup, but the right way to do it would be a defaultdict, or a Counter anyway. from collections import defaultdict
def count_names():
names = defaultdict(int)
for name in sys.stdin.readlines():
name = name.strip()
names[name] += 1
...
|
|