I am new to python. ** => operator is used for calculating exponential .
print(2 ** 3) //8
print(-2 ** 3) //-8
print(-2 ** 2) //-4
It should print 4 only right ?
I am new to python. ** => operator is used for calculating exponential .
print(2 ** 3) //8
print(-2 ** 3) //-8
print(-2 ** 2) //-4
It should print 4 only right ?
See 6.5. The power operator. And more specifically:
Thus, in an unparenthesized sequence of power and unary operators, the operators are evaluated from right to left (this does not constrain the evaluation order for the operands): -1**2 results in -1.