how is the answer to this 512? (2 ** 3 ** 2) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

how is the answer to this 512? (2 ** 3 ** 2)

Please help me understand the answer to this. I am a bit confused about raising another power.

29th Sep 2020, 12:39 AM
Keston Shook
Keston Shook - avatar
3 Answers
+ 7
Hi Keston Shook 3**2 is the same thing as 3^2, which is the same thing as 3 × 3 = 9 Now 2 ^ 3 ^ 2 = 2 ^ 9 2 ^ 9 = 2×2×2×2×2×2×2×2×2 = 512!
29th Sep 2020, 1:19 AM
Vachila64☕
Vachila64☕ - avatar
+ 2
this is because you dont do (2**3) ** 2 witch will result in: 64. you do 2 to the power of 3 to the power of 2. so 2 ** 9 or 2 to the power of 9. because 2 ** 3 = 9. if you want the result of 64 do ((2**3)**2).
29th Sep 2020, 1:20 AM
Jadon .P. Wolfgang
Jadon .P. Wolfgang - avatar
+ 2
Think of it as 2**(3**2)=2**9=512. If you feel unsure of how an exponent expression will get evaluated, then simply add parentheses to positively tell the interpreter/compiler how you want it done.
29th Sep 2020, 1:22 AM
Brian
Brian - avatar