Binary, Hex, and Decimal string conversions

Michael Bentley michael at jedimindworks.com
Sun Aug 12 22:04:10 EDT 2007


On Aug 12, 2007, at 6:28 PM, Dick Moores wrote:

> n = 12
> base = 36
> print to_base(n, base)
> ==========================================
> This seems to work fine for n >= base, but not for n < base. For  
> example, the code shown returns "c". Is my indentation wrong, or  
> the code? It seems to me that the code should work for the general  
> case, not just for n >= base.

Isn't 'c' the correct answer?

Regards,
Michael
---
Simplicity is the ultimate sophistication. -Leonardo da Vinci



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070812/948e7e2b/attachment.html>


More information about the Python-list mailing list