added two example programs plus gitignore file
[harrypotter-wikipedia-cdsw] / hpwp-minor.py
1 from csv import DictReader
2
3 input_file = open("hp_wiki.csv", 'r')
4
5 num_edits = 0
6 num_anon = 0
7 for row in DictReader(input_file):
8     num_edits = num_edits + 1
9     if row["anon"] == "False":
10         num_anon = num_anon + 1
11
12 prop_anon = num_anon / num_edits
13
14 print("total edits: %s" % num_edits)
15 print("anon edits: %s" % num_anon)
16 print("proportion anon: %s" % prop_anon)

Benjamin Mako Hill || Want to submit a patch?