Popular recipes tagged "example" but not "prime"http://code.activestate.com/recipes/tags/example-prime/2015-06-25T17:55:33-07:00ActiveState Code RecipesExamples for random float between 0 and 1 (Python) 2015-06-25T17:55:33-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/579072-examples-for-random-float-between-0-and-1/ <p style="color: grey"> Python recipe 579072 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/example/">example</a>, <a href="/recipes/tags/random/">random</a>). </p> <p>I was researching how floats are stored in a computer and was trying to think up a way to generate random values between 0 and 1. Python already provides an implementation allowing this already, and two of the functions below are directly inspired by that code, but the third is a slightly different way of doing the same thing. A similar version of this code has been used to implement similar functionality in C# at one time. Others might also find it useful if they want to create equivalent code in a separate language while having access to random bytes but not random floats. It should be noted that the various implementations get slower as you go down the list.</p> Morse Code (Python) 2012-01-12T23:45:12-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578012-morse-code/ <p style="color: grey"> Python recipe 578012 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/demonstration/">demonstration</a>, <a href="/recipes/tags/example/">example</a>, <a href="/recipes/tags/experiment/">experiment</a>, <a href="/recipes/tags/morse/">morse</a>, <a href="/recipes/tags/morse_code/">morse_code</a>, <a href="/recipes/tags/program/">program</a>, <a href="/recipes/tags/sound/">sound</a>). Revision 3. </p> <p>After seeing another recipe recently that helps people with Morse Code, I was inspired to clean up the following code just a bit to make it worthy for the rest of the world. After being executed, it waits for lines of text to be entered, compiles each one in turn into timing codes, and plays them back with a simple execution</p> Rudimentary Database Engine (Python) 2013-09-02T01:51:53-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577825-rudimentary-database-engine/ <p style="color: grey"> Python recipe 577825 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/engine/">engine</a>, <a href="/recipes/tags/example/">example</a>, <a href="/recipes/tags/experiment/">experiment</a>). Revision 2. </p> <p>This module was written for self-academic purposes in an attempt to understand databases better. Just as in college where students are required to reinvent "wheels" like linked lists, trees, binary searches, et cetera, developing this program helped me understand some of the things that goes on behind the scenes in a database while also helping to learn what the desired output of each operation should be. The code in this module provides support for running a simple database engine that runs completely in memory and allows usage of various concepts available in a structured query language to get and set data that may be saved to file.</p> Color Study 1 (Python) 2011-04-05T23:35:32-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577636-color-study-1/ <p style="color: grey"> Python recipe 577636 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/example/">example</a>, <a href="/recipes/tags/experiment/">experiment</a>, <a href="/recipes/tags/gui/">gui</a>, <a href="/recipes/tags/sandbox/">sandbox</a>). </p> <p>The following program was written to understand how two different color systems related to each other, RGB and HSV. The recipe could be better written and extended further to support other color systems in addition to the two it already uses, but it is a simple example of how one might go about to understand what others speak of when talking about color. The GUI is simple to use and responsive, and the code is a good demonstration of what may need to be written to produce a demonstration such as this one.</p> <p>If you have suggestions or would like to vote this recipe down, please provide an explanation of the problem along with a solution that you would propose and implement to improve upon what is presented.</p>