Operator precedence problem

Chris Angelico rosuav at gmail.com
Sun Jun 5 12:24:37 EDT 2016


On Sun, Jun 5, 2016 at 4:53 PM, ICT Ezy <ictezy at gmail.com> wrote:
>>>> 2 ** 3 ** 2
> Answer is 512
> Why not 64?
> Order is right-left or left-right?

This example follows the mathematical standard; you start from the
"top" (the right hand side), and work your way down.

>>> (3**3) % 10
7
>>> (3**3**3) % 10
7
>>> (3**3**3**3) % 10
.... waiting......

https://en.wikipedia.org/wiki/Graham%27s_number

ChrisA



More information about the Python-list mailing list