[Tutor] a puzzle about -3**2 vs (-3)**2
D Wyatt
fiberfolly at gmail.com
Fri Jul 31 02:58:27 CEST 2015
I just read in a book a little while ago that ** trumps a negative
sign? I am struggling with the audacity of that as -1 is negative 1,
NOT minus 1. How can an arithmetic operation trump an attribute of a
negative integer? It truly makes no sense to me. Thank you for any
enlightenment you can provide.
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 3**2
9
>>> (-3)**2
9
>>> -3**2
-9
>>>
--
Deb Wyatt in WA
More information about the Tutor
mailing list