math.e
or from math import e
(= 2.718281…)
The two expressions math.exp(x)
and e**x
are equivalent
however:
Return e raised to the power x, where e = 2.718281… is the base of natural logarithms. This is usually more accurate than math.e ** x
or pow(math.e, x)
. docs.python
for power use **
(3**2
= 9), not " ^ "
" ^ " is a bitwise XOR operator (& and, | or), it works logicaly with bits.
So for example 10^4
=14 (maybe unexpectedly) ? consider the bitwise depiction:
(0000 1010 ^ 0000 0100 = 0000 1110) programiz