Loop from 'aaaa' to 'tttt' ?
Steven Taschuk
staschuk at telusplanet.net
Tue Jun 17 13:35:51 EDT 2003
Quoth I:
[...]
> def antonianvalue(string, base=10):
> digits = list(string)
> value = 0
> for digit in digits:
> value = value*base
> value = value + ord(digits) - ord('0') + 1 # no "+ 1" normally
> return value - 1 # no "- 1" normally
*sigh*
That should be ord(digit), of course, not ord(digits).
One of these days I might learn to post exactly what I've tested.
--
Steven Taschuk staschuk at telusplanet.net
"Telekinesis would be worth patenting." -- James Gleick
More information about the Python-list
mailing list