+ 1

Why are h and i different? I don't understand. Looks like it's calculating backward.

h = 2**1**2**2 i = 2**2**2 print(h) print(i)

5th Nov 2017, 2:52 AM
John S.R. LEE
John S.R. LEE - avatar
3 odpowiedzi
+ 14
It is maths actually h is calculated this way h = 2 ** 1 ** 2 ** 2 h = 2 ** 1 ** 4 h = 2 ** 1 h = 2 i = 2 ** 2 ** 2 i = 2 ** 4 i = 16
5th Nov 2017, 3:20 AM
Lord Krishna
Lord Krishna - avatar
+ 4
2**1**2+1=(2**(1**2))+1 not backward just.... **(raise to power) have high precedence you know
5th Nov 2017, 3:07 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
0
if u want them to be indifferent... do some brackets.. h =(((2**1)**2)**2)=16 i= ((2**2)**2) = 16
5th Nov 2017, 4:11 AM
sayan chandra
sayan chandra - avatar