Decimals and other numbers
Chris Angelico
rosuav at gmail.com
Fri Jan 9 11:39:35 CET 2015
On Fri, Jan 9, 2015 at 9:20 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> On the basis that m**n means m multiplied by itself n times:
>
> 5**4 = 5*5*5*5 = 625
>
> that gives us:
>
> 0**0 = zero multiplied by itself zero times.
>
> You can multiply 0 by any number you like, and the answer will always be 0,
> not 1. Even if that other number is 0, the answer is still 0.
5 * 0 * 0 * 0 * 0 = 0
You can multiply 5 by 0 any number of times you like, and the answer
will always be 0... unless you never multiply it by 0 at all, in which
case it'll be 5. Multiplying 0 by any number, including 0, is 0... but
*not* multiplying 0 by 0 doesn't have to give 0. 0**0 is the result of
not multiplying any zeroes together, so it doesn't follow the rules of
multiplying zeroes together.
Look at it another way. 6**x modulo 10 will always be 6, right? 6, 36,
216... the rules for multiplying mean that the last digit will be
consistent. (That's how we can know what the last digits of Graham's
Number are, despite having no way to even comprehend its scale.) So
what's 6**0? Is that going to end with 6, too, to be consistent? No,
because we're not multiplying any sixes in, so the answer's simply 1.
ChrisA
More information about the Python-list
mailing list