Adds problems and result saving
This commit is contained in:
@ -1,2 +1,3 @@
|
||||
from .copycat import Copycat, Reporter # noqa
|
||||
from .plot import plot_answers
|
||||
from .io import save_answers
|
||||
|
||||
9
copycat/io.py
Normal file
9
copycat/io.py
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
def save_answers(answers, filename):
|
||||
answers = sorted(answers.items(), key=lambda kv : kv[1]['count'])
|
||||
keys = [k for k, v in answers]
|
||||
counts = [str(v['count']) for k, v in answers]
|
||||
with open(filename, 'w') as outfile:
|
||||
outfile.write(','.join(keys))
|
||||
outfile.write('\n')
|
||||
outfile.write(','.join(counts))
|
||||
Reference in New Issue
Block a user