Popular recipes tagged "base" but not "python"http://code.activestate.com/recipes/tags/base-python/2011-02-24T00:33:07-08:00ActiveState Code RecipesConverts from decimal to any base ( between 2 and 26 ) (Python) 2011-02-24T00:33:07-08:00Shashwat Anandhttp://code.activestate.com/recipes/users/4172995/http://code.activestate.com/recipes/577586-converts-from-decimal-to-any-base-between-2-and-26/ <p style="color: grey"> Python recipe 577586 by <a href="/recipes/users/4172995/">Shashwat Anand</a> (<a href="/recipes/tags/algorithms/">algorithms</a>, <a href="/recipes/tags/base/">base</a>). </p> <p>This function takes in any base-10 integer and returns the string representation of that number in its specified base-n form. The code was inspired from <a href="http://code.activestate.com/recipes/65212-convert-from-decimal-to-any-base-number/" rel="nofollow">http://code.activestate.com/recipes/65212-convert-from-decimal-to-any-base-number/</a> , thereby improving upon it.</p> Metric Prefix Symbol and Decimal Quiz (Python) 2009-10-11T18:39:58-07:00Daniel Sahahttp://code.activestate.com/recipes/users/4171644/http://code.activestate.com/recipes/576928-metric-prefix-symbol-and-decimal-quiz/ <p style="color: grey"> Python recipe 576928 by <a href="/recipes/users/4171644/">Daniel Saha</a> (<a href="/recipes/tags/base/">base</a>, <a href="/recipes/tags/decimal/">decimal</a>, <a href="/recipes/tags/metric/">metric</a>, <a href="/recipes/tags/prefix/">prefix</a>, <a href="/recipes/tags/symbol/">symbol</a>, <a href="/recipes/tags/units/">units</a>). Revision 3. </p> <p>Quiz on the metric prefixs, symbols, and decimals associated with each other.</p> Base Conversion decimal to base = len(map) (Python) 2008-08-20T05:01:39-07:00Mark Zitnikhttp://code.activestate.com/recipes/users/4166559/http://code.activestate.com/recipes/576435-base-conversion-decimal-to-base-lenmap/ <p style="color: grey"> Python recipe 576435 by <a href="/recipes/users/4166559/">Mark Zitnik</a> (<a href="/recipes/tags/base/">base</a>, <a href="/recipes/tags/conversion/">conversion</a>, <a href="/recipes/tags/decimal/">decimal</a>, <a href="/recipes/tags/sequence/">sequence</a>, <a href="/recipes/tags/web_site/">web_site</a>). Revision 7. </p> <p>This code enable decimal base conversion according map length and a different char set.</p> <p>Example:</p> <ul> <li>map = ['0','1'] base 2 10 -> 1010</li> <li>map = ['a','b'] base 2 10 -> baba</li> <li>map = ['a','b','c','d','e','f','g','h','i','j','k','l'] base 12 10 -> k</li> <li>map = ['a','b','c','d','e','f','g','h','i','j','k','l'] base 12 100 -> ie</li> </ul> <p>this simple method can be used in web sites to hide a well known decimal sequence like user ids.</p>