0

In this operation, I use Python and the answer is 6566, but if I solve it on paper, the answer is 734. Can anyone explain?

print(5+(2+1)**2**3)

26th Oct 2017, 8:23 AM
Đồng VĆ© Minh PhĂșc
Đồng VĆ© Minh PhĂșc - avatar
6 Respostas
+ 2
Because it is calculating for 2**3 = 8 if you don't use parentheses. print(5+(2+1)**8)
26th Oct 2017, 9:22 AM
Ferhat Sevim
Ferhat Sevim - avatar
+ 2
It's fun that Python thinks one way and humans think the other.
26th Oct 2017, 9:27 AM
Đồng VĆ© Minh PhĂșc
Đồng VĆ© Minh PhĂșc - avatar
+ 1
You only forgot adding parentheses between powers. The right answer is here print(5+((2+1)**2)**3)
26th Oct 2017, 8:54 AM
Ferhat Sevim
Ferhat Sevim - avatar
0
use brackets correctly
26th Oct 2017, 8:26 AM
shobhit
shobhit - avatar
0
what do you mean?
26th Oct 2017, 8:30 AM
Đồng VĆ© Minh PhĂșc
Đồng VĆ© Minh PhĂșc - avatar
0
I get it, but there is no error in Python if you dont use the parentheses. How can Python calculate the operations without those parentheses?
26th Oct 2017, 9:10 AM
Đồng VĆ© Minh PhĂșc
Đồng VĆ© Minh PhĂșc - avatar