RosettaCodeData/Task/Exponentiation-order/Python/exponentiation-order.py

14 lines
199 B
Python
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
>>> 5**3**2
1953125
>>> (5**3)**2
15625
>>> 5**(3**2)
1953125
>>> # The following is not normally done
>>> try: from functools import reduce # Py3K
except: pass
>>> reduce(pow, (5, 3, 2))
15625
>>>