+ 1
Can anyone show me this exponention calculation [Solved]
The answer is shown around 43,000 and I can't figure it out why is it like that in the calculator although I got the same answer in calculator. It is just an experiement which I am doing while learning https://code.sololearn.com/cM7G9veQ4pDy/?ref=app
6 odpowiedzi
+ 2
It calculates from the right side, not sure why though
3 ** 2 ** 2 ** 2
> 3 ** 2 ** 4
> 3 ** 16
> 43,046,721
+ 3
Hi Kartik!
Unlike other operators, exponential operator is evaluated right to left in python.
Alternatively, you can just think about what we're doing in usual mathematics. We can write this expression on a piece of paper like this
2
2
2
3 2⁴
So, it can be shorten as 3 which is equal to 3¹⁶.
+ 1
Thank you Nick
+ 1
No problem, I would love to give you an explanation but math isn't really my thing 😅
+ 1
Nick The way you explained above is enough for me to understand😉
+ 1