+ 2

How can this code solve 2**3**2 to give 512

Python

19th Sep 2020, 1:41 PM
Muhammad Abdulmalik
Muhammad Abdulmalik - avatar
3 Respuestas
+ 3
3**2=9 so 2**9 is equal to 512
19th Sep 2020, 1:46 PM
Abhay
Abhay - avatar
+ 1
exponenents are calculated first in python, so youd have to say this (2**3)**2 == 64
19th Sep 2020, 1:44 PM
Jacob
Jacob - avatar
+ 1
print(2**3**2) is samsme as print(2**(3**2)) =512 Associativity is right to left for exponent.
19th Sep 2020, 4:43 PM
Jayakrishna 🇮🇳