+ 1

Why 10**2**3 equals to 100000000

print(10**2) —> Output: 100 print(100**3) —> Output: 1000000 print(10**2**3) —> Output: 100000000 Could anyone tell me why 10**2**3 is not 1000000... Language: Python

29th May 2019, 2:35 PM
Alice
Alice - avatar
5 Respuestas
+ 5
you go from the end so first is 2**3 and then 10**8
29th May 2019, 2:38 PM
Hubert Dudek
Hubert Dudek - avatar
+ 1
10**2**3 =10**(2**3) =10**8 100000000
29th May 2019, 2:38 PM
Farry
Farry - avatar
+ 1
It's how math (and Python) works. "Operators in the same box group left to right (except for exponentiation, which groups from right to left)". https://docs.python.org/3/reference/expressions.html#operator-precedence
29th May 2019, 3:26 PM
Diego
Diego - avatar
0
** operator goes from the end?? that’s strange!
29th May 2019, 2:44 PM
Alice
Alice - avatar
0
If brackets were put up you'd be calculating according to the BODMAS rules, if there aren't any you should proceed just like math
30th May 2019, 3:15 AM
Soumya Polisetty
Soumya Polisetty - avatar