+ 1
Why the following code is false?
3 Respostas
+ 6
Run it like this and you will see the difference:
from math import e ,log
print(e**log(2))
+ 5
because it's a float value you get from e**log(2) which is an aproximation but not exact.
when using == you test if the two numbers are exactly the same
to get to true you have to either round the result or check if the difference between the two values is very small
+ 2
Thx ❤️ ❤️