當前位置:聚美館>智慧生活>心理>

int和input的區別

心理 閱讀(2.06W)
int和input的區別

int釋義:

abbr. 整數,中斷國際組織(International organizations)

例句:

Addition of two signed ints results in a signed int.

兩個有符號整數相加的結果是一個有符號的整數。

input釋義:

n. 投入輸入電路

vt. [自][電子] 輸入將…輸入電腦

例句:

The shortage of funding input has put the company into a development impasse.

資金投入的短缺使公司陷入了發展僵局。

詞組:

input data輸入數據輸入資料

input signal[電]輸入信號

input method輸入法

python中input()和int(input())是有區別的.

input()返回的是一個字元串

因爲code也是字元串類型,所以a==code可以比較字元串的內容是否相等

而int(input())把input()返回的字元串轉換成整型,返回的是整型

code是字元串型,整型的a和字元串型的code肯定不相等,所以不會輸出win

如果你把while a == code:改成while a == int(code):把code也轉換成整型,兩者就可以比較,可以輸出win了