Popular recipes tagged "meta:loc=294"http://code.activestate.com/recipes/tags/meta:loc=294/2014-02-13T20:55:55-08:00ActiveState Code RecipesQuiz Me 2.5 (XML example) (Python)
2011-01-11T00:51:24-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577541-quiz-me-25-xml-example/
<p style="color: grey">
Python
recipe 577541
by <a href="/recipes/users/2608421/">Stephen Chappell</a>
(<a href="/recipes/tags/gui/">gui</a>, <a href="/recipes/tags/program/">program</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/quiz/">quiz</a>).
Revision 2.
</p>
<p>Before discovering <a href="http://quizlet.com/" rel="nofollow">http://quizlet.com/</a>, the following program was developed for running custom quizzes to help with studying for college courses. The program is not very advanced, but it works reasonably well for what it was designed to do. If the program were developed further, it would need greater capabilities than it currently has and would require a secondary system for actually creating the quizzes (currently, they are hand-typed). Quiz Me could be a starting point for anyone who wishes to actually write a program such as this and inspire others to write much better programs than what this recipe currently offers.</p>
<p>This is an example testbank file for Quiz Me. The questions and answers were created from a book used in a "HI 101" college class. What is presented here is a small sample of what would more likely be a much larger bank of question and answers used for automated quizzing or testing purposes. The XML shown here is formatted correctly dictated by an unwritten specification that the testbank (parsing) module requires. It is the quizcore module that takes the data through its final transformation and also builds questions and answers based on the material available. Once the .build() method has been called on classes inheriting from the _Category class, public attributes (QnA) become available on the _Category objects containing enough information for asking questions with provided answers. Fact objects also have .build() methods; once called, public Q2A and A2Q attributes can be used to find valid mappings of questions to answers and answers to questions.</p>
Simple polynomial class (Python)
2014-02-13T20:55:55-08:00Sam Dentonhttp://code.activestate.com/recipes/users/4172262/http://code.activestate.com/recipes/576953-simple-polynomial-class/
<p style="color: grey">
Python
recipe 576953
by <a href="/recipes/users/4172262/">Sam Denton</a>
(<a href="/recipes/tags/arithmetic/">arithmetic</a>, <a href="/recipes/tags/calculator/">calculator</a>, <a href="/recipes/tags/polynomial/">polynomial</a>).
Revision 7.
</p>
<p>This implements polynomial functions over a single variable in Python. It represents the polynomial as a list of numbers and allows most arithmetic operations, using conventional Python syntax. It does not do symbolic manipulations. Instead, you can do things like this:</p>
<pre class="prettyprint"><code>x = SimplePolynomial()
eq = (x-1)*(x*1)
print eq # prints 'X**2 - 1'
print eq(4) # prints 15
</code></pre>