fixed a bug where this was counting every match, not every name that is a subset
[babynames_answers] / ssadata.py
1 NAMES_LIST = "yob2013.txt"
2
3 boys = {}
4 girls = {}
5
6 for line in open(NAMES_LIST, 'r').readlines():
7     name, gender, count = line.strip().split(",")
8     count = int(count)
9
10     if gender == "F":
11         girls[name.lower()] = count
12     elif gender == "M":
13         boys[name.lower()] = count

Benjamin Mako Hill || Want to submit a patch?