+ 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
5 odpowiedzi
+ 5
you go from the end so first is 2**3 and then 10**8
+ 1
10**2**3
=10**(2**3)
=10**8
100000000
+ 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
0
** operator goes from the end?? that’s strange!
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