On Thu, Nov 27, 2003, Andrew Koenig wrote: >Tim Peters: >> >> A different approach makes iteration much more natural: the number of >> digits in n (>= 0) is the least i >= 1 such that 10**i > n. Then >> iterative >> code is an obvious search loop: >> >> i = 1 >> while 10**i <= n: >> i += 1 >> return i > > This code relies on 10**i being exact. Is that guaranteed? For Python ints, yes. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ Weinberg's Second Law: If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4