Issue 31519: Negative number raised to even power is negative (-1 ** even = negative)
Hello, I'm only a novice with Python, so please take it easy on me if I have transgressed. I am using Python 3.6.2 on a win10 64 bit machine, and entered this: >>> a= [-1 ** x for x in range(1,10)] >>> print(a) [-1, -1, -1, -1, -1, -1, -1, -1, -1] which is not correct. however, entering this: >>> b = [pow(-1, x) for x in range(1,10)] >>> print(b) [-1, 1, -1, 1, -1, 1, -1, 1, -1] which is correct. Any negative number entered and raised to an even power seems to not return a positive value, but the pow(x,y) function works. I never have reported a bug on any programming language ever, and surprisingly I can't find a report of this (I did search, so if it's out there, I must not understand how to use the search. Forgive me. As I said, I'm very new to Python and I'm not a professional programmer.)