A question on modification of a list via a function invocation

Steve D'Aprano steve+python at pearwood.info
Thu Sep 7 21:59:08 EDT 2017


On Fri, 8 Sep 2017 05:15 am, Stefan Ram wrote:

>   It computing newsgroups, for example, people
>   ask about how to compute the number of digits
>   of a number, when, actually, only numerals
>   (representations of numbers in a particular
>   numeral system) have digits.

Um, yes? That's implicit in the question -- and generally the numeral system in
question is implied to be 10. Context is important.

But for what it's worth, if you take a random number from the Reals, then the
answer will be "infinite digits" for Almost All[1] numbers, no matter what
number base you are using.

A harder question is, what if you take a random number from the Integers? How
many digits will it have in (say) base 10? I don't have a good answer to that.
I think it may be ill-defined.




[1] https://en.wikipedia.org/wiki/Almost_all


-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list