程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python competition question -01- which of the following is not a python operator?

編輯:Python

Prepare to collect some interesting 、 popular 、 There are certain challenges 、 Knowledgeable Python subject , The title of the article is 「Python The competition question 」 start .

Which of the following is not Python Operator :

  • 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 .


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved