Popular recipes tagged "educational"http://code.activestate.com/recipes/tags/educational/2015-12-28T17:56:08-08:00ActiveState Code RecipesMandelbrot Set made simple (Python) 2015-12-28T17:56:08-08:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/579143-mandelbrot-set-made-simple/ <p style="color: grey"> Python recipe 579143 by <a href="/recipes/users/4076953/">Jack Trainor</a> (<a href="/recipes/tags/educational/">educational</a>, <a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/mandelbrot/">mandelbrot</a>, <a href="/recipes/tags/mathematics/">mathematics</a>). Revision 2. </p> <p>This is a mini-framework for exploring the Mandelbrot Set.</p> <p>It outputs to a Tkinter window or to a PNG file (Pillow package required). It includes a disk caching mechanism for saving and later retrieving Mandelbrot calculations to avoid recalculating the Set on each run.</p> <p>See module documentation for further information. Compatible with Python 2 and 3.</p> "More Sex is Safer Sex" Paradox (Python) 2010-09-22T02:56:37-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/577403-more-sex-is-safer-sex-paradox/ <p style="color: grey"> Python recipe 577403 by <a href="/recipes/users/4076953/">Jack Trainor</a> (<a href="/recipes/tags/educational/">educational</a>, <a href="/recipes/tags/simulation/">simulation</a>). </p> <p>In his book, "More Sex Is Safer Sex: The Unconventional Wisdom of Economics, " Steven Landsburg argues that if sexual conservatives took more sexual partners it would improve everyone's chances of finding low-risk partners, thereby reducing the spread of STDs for all. </p> <p>See <a href="http://www.nytimes.com/2007/07/08/books/chapters/0708-1st-land.html?_r=1&amp;pagewanted=print" rel="nofollow">http://www.nytimes.com/2007/07/08/books/chapters/0708-1st-land.html?_r=1&amp;pagewanted=print</a> .</p> <p>This recipe attempts to simulate the scenario which Landsburg describes and test his claim that "More sex is safer sex."</p> TRAC Interpreter -- Sixties programming language (Python) 2010-08-22T19:05:09-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/577366-trac-interpreter-sixties-programming-language/ <p style="color: grey"> Python recipe 577366 by <a href="/recipes/users/4076953/">Jack Trainor</a> (<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/educational/">educational</a>, <a href="/recipes/tags/interpreter/">interpreter</a>, <a href="/recipes/tags/language/">language</a>, <a href="/recipes/tags/trac/">trac</a>). </p> <p>A Python implementation of an interpreter for the TRAC programming language developed by Calvin Mooers in the early 1960s. This implementation reconstructs Mooers' original algorithm in Python and supports only a limited number of TRAC primitives for demonstration purposes.</p> TRAC Interpreter - Dragon style (Python) 2010-09-20T00:42:21-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/577396-trac-interpreter-dragon-style/ <p style="color: grey"> Python recipe 577396 by <a href="/recipes/users/4076953/">Jack Trainor</a> (<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/educational/">educational</a>, <a href="/recipes/tags/interpreter/">interpreter</a>, <a href="/recipes/tags/language/">language</a>, <a href="/recipes/tags/lexical_analyzer/">lexical_analyzer</a>, <a href="/recipes/tags/trac/">trac</a>). </p> <p>I've rewritten the TRAC interpreter from <a href="http://code.activestate.com/recipes/577366/">Recipe 577366</a> using a modern recursive descent style based on the Dragon book's lexer/parser model at the end of "Compliers: Principles, Techniques and Tools," Chapter 2, by Aho, Sethi, Ullman (1986).</p> Python 2.7 Linked List vs List (Python) 2010-08-13T04:05:42-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/577355-python-27-linked-list-vs-list/ <p style="color: grey"> Python recipe 577355 by <a href="/recipes/users/4076953/">Jack Trainor</a> (<a href="/recipes/tags/educational/">educational</a>, <a href="/recipes/tags/list/">list</a>). </p> <p>Linked list implementation based on Python 2.7 collections.MutableSequence with a few benchmarks comparing the linked list with the built-in list type.</p> TRAC Interpreter - Class and Stack version (Python) 2010-09-20T01:16:07-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/577397-trac-interpreter-class-and-stack-version/ <p style="color: grey"> Python recipe 577397 by <a href="/recipes/users/4076953/">Jack Trainor</a> (<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/educational/">educational</a>, <a href="/recipes/tags/interpreter/">interpreter</a>, <a href="/recipes/tags/language/">language</a>, <a href="/recipes/tags/lexical_analyzer/">lexical_analyzer</a>, <a href="/recipes/tags/trac/">trac</a>). </p> <p>This is my third and final version of the Trac Interpreter from <a href="http://code.activestate.com/recipes/577366/">Recipe 577366</a>. It processes the character stream into appropriate class objects and stores these objects on a stack.</p> Dragon Lexical Analyzer (Python) 2010-09-01T14:49:37-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/577380-dragon-lexical-analyzer/ <p style="color: grey"> Python recipe 577380 by <a href="/recipes/users/4076953/">Jack Trainor</a> (<a href="/recipes/tags/educational/">educational</a>, <a href="/recipes/tags/lexical_analyzer/">lexical_analyzer</a>, <a href="/recipes/tags/parsing/">parsing</a>). Revision 2. </p> <p>The lexical analyzer from "Compliers: Principles, Techniques and Tools," Chapter 2, by Aho, Sethi, Ullman (1986) implemented in Python.</p> Attribute-based Framework 1: Basics (Python) 2010-07-21T21:40:54-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/577327-attribute-based-framework-1-basics/ <p style="color: grey"> Python recipe 577327 by <a href="/recipes/users/4076953/">Jack Trainor</a> (<a href="/recipes/tags/educational/">educational</a>, <a href="/recipes/tags/framework/">framework</a>, <a href="/recipes/tags/oop/">oop</a>, <a href="/recipes/tags/simulation/">simulation</a>). Revision 2. </p> <p>I am adapting Prof. David Cheriton's OO software methodology to Python. It's an approach for building industrial-strength code with a disciplined architecture, consistent naming conventions, and a rigorous division of interface from implementation. I'll be adding more of his techniques in further recipes. These recipes are based on Cheriton's CS249a course at Stanford.</p> Attribute-based Framework 2: Notifications (Python) 2010-07-23T20:12:10-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/577330-attribute-based-framework-2-notifications/ <p style="color: grey"> Python recipe 577330 by <a href="/recipes/users/4076953/">Jack Trainor</a> (<a href="/recipes/tags/educational/">educational</a>, <a href="/recipes/tags/framework/">framework</a>, <a href="/recipes/tags/oop/">oop</a>, <a href="/recipes/tags/simulation/">simulation</a>). Revision 2. </p> <p>I am adapting Prof. David Cheriton's OO software methodology to Python. It's an approach for building industrial-strength code with a disciplined architecture, consistent naming conventions, and a rigorous division of interface from implementation. I'll be adding more of his techniques in further recipes. These recipes are based on Cheriton's CS249a course at Stanford.</p> State Capitals Quiz (Python) 2009-05-28T07:45:06-07:00joedaviscpahttp://code.activestate.com/recipes/users/4170361/http://code.activestate.com/recipes/576783-state-capitals-quiz/ <p style="color: grey"> Python recipe 576783 by <a href="/recipes/users/4170361/">joedaviscpa</a> (<a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/educational/">educational</a>, <a href="/recipes/tags/random/">random</a>). </p> <p>The program loops through all 50 states asking for the state capital. </p>