+ 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

21st Aug 2020, 1:39 AM
Tyrel Hightower
Tyrel Hightower - avatar
4 Réponses
+ 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
21st Aug 2020, 6:50 AM
Nilesh
Nilesh - avatar
+ 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
21st Aug 2020, 1:51 AM
Steven M
Steven M - avatar
+ 1
oh thank you so much that helps me understand it
21st Aug 2020, 2:35 AM
Tyrel Hightower
Tyrel Hightower - avatar