Prepare to collect some interesting 、 popular 、 There are certain challenges 、 Knowledgeable Python subject , The title of the article is 「Python The competition question 」 start .
A) @
B) ~
C) **
D) //
E) &
F) None of the above?
Have you chosen ? Select it and turn down .
The right answer is F
Isn't surprise 、 No surprise ?
explain :
First look at the easy
B) ~ It means reverse bit by bit , such as ~1 The result is that -2:
>>> ~1
-2
If you want to know why -2, Then you need to know that computers store numbers in the form of complements , You can look at the previous article On complement , College teachers are very irresponsible .
C) ** This is a power operation , such as 2**3 It means 2 Of 3 Power :
>>>2 ** 3
8
D) // This representation divides into integers :
>>> 3//2
1
>>> 5//2
2
E) & This is bitwise and operation :
>>> 1 & 1
1
>>> 1 & 0
0
>>> 0 & 0
0
A) @ Many people think this is not an operator , In fact, it is , Representation matrix multiplication , We can type help('NUMBERMETHODS') see :
however ,@ Operators are restricted , It can only be used in specific libraries , For example numpy in :
>>> x1
array([[1, 2],
[3, 4]])
>>> y1
array([[2, 1],
[4, 3]])
>>> x1 @ y1
array([[10, 7],
[22, 15]])
So the answer is F.
If there is harvest , Welcome to thumb up 、 forward 、 Comment on .