2.1.3.8 Operators - data manipulation tools

Operators and their bindings: exponentiation

Repeat the experiment, but now with exponentiation.
Use this snippet of code:
print(2 ** 2 ** 3)
The two possible results are:
  • 2 ** 2 → 44 ** 3 → 64
  • 2 ** 3 → 82 ** 8 → 256

Run the code. What do you see?
The result clearly shows that the exponentiation operator uses right-sided binding.


  • Console 

Comments

Popular Posts