Message302529
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.) |
|
Date |
User |
Action |
Args |
2017-09-19 14:51:10 | rdhunkins | set | recipients:
+ rdhunkins |
2017-09-19 14:51:10 | rdhunkins | set | messageid: <1505832670.28.0.985566870824.issue31519@psf.upfronthosting.co.za> |
2017-09-19 14:51:10 | rdhunkins | link | issue31519 messages |
2017-09-19 14:51:10 | rdhunkins | create | |
|