+ 2
Python 2 ** 3 ** 2 = 512
can someone please explain how it comes to that answer? I understand 2 ** 5 is 2 * 2 * 2 * 2 *2 but how to you get 512 out of the problem above...I just need to understand how it works please
3 odpowiedzi
+ 12
Tyrel Hightower
We should start the operation from right side so,
2 ** 3 ** 2 i.e 2^3^2
So first 2^(3^2)
3**2 = 9
So,
2^9
=> 2×2×2×2×2×2×2×2×2
=> 512
+ 7
Its not 2**5, you don't add the exponents. Your base is 2, which is raised to the 3rd power and the 3 is raised to the 2nd power. You perform exponent operations first.
2**(3**2)
Start from the right:
3**2=9
2**9=512
+ 1
oh thank you so much that helps me understand it