On 06/04/2016 11:53 PM, ICT Ezy wrote:
2 ** 3 ** 2
Answer is 512
Why not 64?
Order is right-left or left-right?

Evidently right to left, but you already figured that out.

Python 3.5.1+ (default, Mar 30 2016, 22:46:26)
[GCC 5.3.1 20160330] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 2 ** 3 ** 2
512
>>> 2 ** (3 ** 2)
512
>>> (2 ** 3) ** 2
64
>>>


Here's the relevant documentation page:
    https://docs.python.org/3/reference/expressions.html
Look for "... except for exponentiation, which groups from right to left"

Gary Herron

--
Dr. Gary Herron
Professor of Computer Science
DigiPen Institute of Technology
(425) 895-4418

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to