python面試題集錦
阿新 • • 發佈:2018-08-04
語句 題集 utf-8 重復 運算 code 若有 unicode編碼 數字
一、python2X與python3X的區別
1、python2X源碼雜亂,重復率高;python3X源碼優美簡潔明了。
2、python2X默認使用Unicode編碼,僅支持英文數字特殊字符;python3X默認UTF-8編碼,支持中文。
二、運算符
1、判斷下列邏輯語句的True,False.
1)1 > 1 or 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6
2)not 2 > 1 and 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6
2、求出下列邏輯語句的值。
1),8 or 3 and 4 or 2 and 0 or 9 and 7
2),0 or 2 and 3 and 4 or 6 and 0 or 3
3、下列結果是什麽?
1)、6 or 2 > 1
2)、3 or 2 > 1
3)、0 or 5 < 4
4)、5 < 4 or 3
5)、2 > 1 or 6
6)、3 and 2 > 1
7)、0 and 3 > 1
8)、2 > 1 and 3
9)、3 > 1 and 0
10)、3 > 1 and 2 or 2 < 3 and 3 and 4 or 3 > 2
判斷依據:(1)運算優先級:not>and>or
(2)對於or來說,若有一邊為0,則結果為另一邊;若無0,則為左邊。對於and來說,若有一邊為0,則為o;若無0,則為右邊。
python面試題集錦