+ 13
2**3**2= 512. Why?
So I was doing one of the Python 3 lessons (Basic Concepts, Other Numerical Operations) and I reached the Exponentation point. I understand how you raise one number to the power of another, but how do chained exponentations work?
27 Answers
+ 36
Right to left
2**3**2 == 2^(3^2)
first 3**2 == 9
then 2**9 == 512
+ 6
** means raised to power so first we take 3**2 which is 3 square = 9 .
Then we take 2**9 which is 2 power 9 which is 512 .Hope it helps 🙇🏻♂️
+ 4
Cause python treat 2**3**2 as 2**3**2=2**9=512
+ 4
*=multiplication
**=power
+ 2
Himanshu Shah Whatever 🤦 Comparing Python to HTML is pointless and saying something wrong about HTML is misinformation. The time you are wasting arguing with me can be used to remove that misinformation from your answer. Good luck.
+ 2
You can override the default order R-->L by using parentheses.... for exponentiation 🤔
+ 2
x**y means x^y
in cases like this x**y**z, you have to calculate from rigth to left, i mean x^(y^z)
in your code 2^(3^2) = 2^9 = 512
is it clear?
+ 2
In python power operator is ** . So in order to simplify expression we need to divide it into parts. 2**3=2^3, 3**2=3^2=9 => 2**3**2=2^(3^2)=2^9=512
+ 1
Himanshu Shah 4<sup>2</sup> is not 16. It is 4².
+ 1
Himanshu Shah Well, here is what I can see in your answer.
<<<
Eg. 4 <sup>2</sup> answer is 16.
<<<
That is not true. At least, for the majority of browsers it renders 4² not 16.
+ 1
Don't forget computer reads code from up to down and from right to left
+ 1
you can also do this using the pow() function
+ 1
2**3**2=512
2 to the power 3 =2^3=8
Similarly 8 to the power 3
8^3=512
2^3=8
8^3=512
+ 1
2**3**2 is calculated as :
** Is an exponential operator
So, first 3**2 is calculated which is 9
= 2**9
=512
+ 1
Because 2**3**2 = 2^(3^2) = 2^9 = 512
This is different from (2**3)**2 , which is (2^3)^2 = 8^2 = 64
+ 1
Well I am at the Lambdas point and looking at this question, you use associativity property of operations. So:2**3**2=2**(3**2). "**" means exponent where the first number is the base and the other is exponent.So we get 2**9=512 In python the first number is the variable so other nunbers are placed in the brackets to be worked with, before the first number in the expression is used as the base.
In short, (2**3)*2=64 which is wrong.
+ 1
2**3**2
Square of 3 is 9 2**9
2⁹=512
+ 1
That's equal to 2**9 which is equal to 512
+ 1
2**3**2
3^2=9
2**9 (2^9)
=512
+ 1
In python, ** means 'to the power of'. So 2**3**2 = 2**9 (because 3^2 = 3x3 = 9). Then, 2**9 = 512 (because 2^9 = 2x2x2x2x2x2x2x2x2 = 512)