0

Well how is this 16

>>> 2**5 32 >>> 9 ** (1/2) 3.0

21st Jun 2018, 4:04 PM
Ihsan
7 Respostas
+ 2
2**(5-1)=16
21st Jun 2018, 4:11 PM
Maninder $ingh
Maninder $ingh - avatar
+ 1
2**4=16
21st Jun 2018, 4:06 PM
Maninder $ingh
Maninder $ingh - avatar
+ 1
2**4 means two to fourth: 2*2*2*2=16 2**5 means the fifth power of two: 32 9**(1/2) is the square root, so it is 3
21st Jun 2018, 4:35 PM
michal
+ 1
i meant 32
21st Jun 2018, 4:49 PM
Ihsan
+ 1
my bad
21st Jun 2018, 4:49 PM
Ihsan
0
i still dont get it am i subtracting the one from the 5
21st Jun 2018, 4:08 PM
Ihsan
0
Well, Python applies operator precedence just like the one in lower primary school 'BODMAS' Hence in our example, the arithmetic in the parenthesis is computed first. I.e (5-1)=4 Then 2**4 is 2 raised to the power of 4, resulting to 16. 😉
22nd Jun 2018, 5:44 AM
Chisekana Innocent
Chisekana Innocent - avatar