+ 1
print(2**3**2)
Please tell me how to do it....please upvote
4 Answers
+ 1
I think it can be simply done by opening your profile and clicking on code bits->click '+'->choose Python and paste it like:
print(2**3**2)
It will give you the answer, now about talking how to calculate it, haven't you started the Python for beginners? If not, start it soon, it will help you.
And the last thing, why you want upvotes?
+ 5
3ÂČ
2 = 2âč = 512
+ 2
calculate from outside to inside
3**2 = 3*3= 9
2**(3**2)= 2**9= 512
+ 1
Fatima Abdul Lateef The evaluation of the execution happens from right to left. If Python had been lacking this chained-operator feature, I could've achieve a similar result by something like:
def chained_pow_op(exp):
exp = [*map(int, exp.split("**"))]
acc = exp[-1]
for x in exp[-2::-1]:
acc = x ** acc
return acc