Hi,

I want to make big question-base of basic algirthms' for CS101
and I thought how to describe them in Python
https://code.google.com/p/algorithm-quiz/source/browse/IDEAS.draft.txt

def's  would be question templates
and params would make the variations
So the code would be pure Python (so easy to find/get examples ;)


Now the headache is how to convert the py code to Moodle format?
On each call of the question-def I want,
to replace parameters in source with their values,
and then to catch the output (as it is (usually) the answer)

seems inspect  + sys.settrace (on calls) could do?
http://docs.python.org/3/library/inspect.html#inspect.getsource
http://docs.python.org/3/library/inspect.html#inspect.getargvalues
http://pymotw.com/2/sys/tracing.html
and output could be catched probably
http://coreygoldberg.blogspot.com/2009/05/python-redirect-or-turn-off-stdout-and.html
or via print redirect to file

I am not much experienced with this area...
Maybe Roberge or others could help - put on the right/best way? :)


-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt
_______________________________________________
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig

Reply via email to