print(3 ** 3 ** 3)
print(27 ** 3)
print(3**3**3)
is output as 7625597484987
print(27**3)
is output 19683
.
I thought of the code print (3 ** 3 ** 3) as the cube of three, the cube of 27 The price is too high. Why is it coming out like this?
python
Due to operator priority,
This is because it was calculated as 3 ** (3**3) = 3**27
. It's good to memorize operator priorities accurately, but field developers use parentheses to clarify code for these ambiguities.
© 2024 OneMinuteCode. All rights reserved.