Python程序設計試試題題庫_第1頁
Python程序設計試試題題庫_第2頁
Python程序設計試試題題庫_第3頁
已閱讀5頁,還剩38頁未讀 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、Python 程序設計?題庫一、填空題第一章 根底知識1、Python 安裝擴展庫常用的是 工具。 pip2、Python 標準庫 math 中用來計算平方根的函數是 。 sqrt3、Python 程序文件擴展名主要有 和兩種,其中后者常用于 GUI 程序。py 、 pyw 4、Python 源代碼程序編譯后的文件擴展名為 。 pyc5、使用 pip 工具升級科學計算擴展庫 numpy 的完整命令是 。 pip install-upgrade numpy 6、使用 pip 工具查看當前已安裝的 Python 擴展庫的完整命令是 。 pip list 7、 在IDLE交互模式中瀏覽上一條語句的快

2、捷鍵是 。 Alt+P8、在 Python 中 表示空類型。 None 9、 列表、元組、字符串是 Python 的 有序無序 序列。有序10、查看變量類型的 Python 內置函數是 。 type 11、查看變量內存地址的 Python 內置函數是 。 id12、以 3 為實部 4 為虛部, Python 復數的表達形式為 或。 3+4j、3+4J13、Python運算符中用來計算整商的是 。ount4的值為。 0 14、Python 標準庫 random 中的 方法作用是從序列中隨機選擇 1 個元素。choice15、Python標準庫random中的sampleseq, k方法作用是從序

3、列中選擇 重復不重復 )的 k 個元素。(不重復)16、random 模塊中 方法的作用是將列表中的元素隨機亂序。( shuffle() )17、執(zhí)行代碼 x, y, z = sorted(1, 3, 2) 之后,變量 y 的值為 。( 2)18、表達式 (1, 2, 3)+(4, 5) 的值為 。( (1, 2, 3, 4, 5)19、表達式 dict(zip(1, 2, 3, 4) 的值為 。( 1: 3,2: 4)20、語句x, y, z = 1,2, 3執(zhí)行后,變量y的值為。( 2)21、 x = 1,3,3, 2,3,1 ,那么表達式sorted(x, key=lambda item

4、:item0+item2)的值為 。( 2, 3, 1, 1, 3, 3)22、 x = 1,3,3, 2,3,1 ,那么表達式sorted(x, key=lambda item:(item1,item2)的值為 。( 2, 3, 1, 1, 3, 3)23、 x = 1,3,3, 2,3,1 ,那么表達式 sorted(x, key=lambda item:(item1, -item2)的值為 。( 1, 3, 3, 2, 3, 1)24、x = 1,2, 3,那么執(zhí)行語句(3)之后,x的值為。( 1,2, 3)25、x = 1:1,那么執(zhí)行語句x2 = 2之后,len(x)的值為。( 2)

5、26、x = 1:1,2:2,那么執(zhí)行語句x2 = 4之后,len(x)的值為。( 2)27、假設已從標準庫functools導入reduce。函數,那么表達式reduce(lambda x, y: x-y, 1,2, 3) 的值為 。(-4)28、假設已從標準庫functools導入reduce()函數,那么表達式reduce(lambda x, y: x+y, 1,2, 3) 的值為 。(6)29、假設已從標準庫functools導入reduce()函數,那么表達式reduce(lambda x,y:max(x,y),1,2,3,4,4,5)的值為 。( 5 )30、有函數定義def de

6、mo(*p):return sum(p),那么表達式 demo(1, 2, 3)的值為、表達式 demo(1, 2, 3, 4) 的值為。( 6、 10)31、列表x = 1,2,那么連續(xù)執(zhí)行命令y = x和(3)之后,x的值為。(1,2, 3)32、列表x = 1,2,那么連續(xù)執(zhí)行命令y = x:和(3)之后,x的值為。(1, 2)33、列表 x = 1, 2,執(zhí)行語句 y = x: 后,表達式 id(x) = id(y) 的值為 。( False)34、列表 x = 1, 2,執(zhí)行語句 y = x 后,表達式 id(x) = id(y) 的值為 。( True )35、列表 x = 1,

7、2,執(zhí)行語句 y = x 后,表達式x is y 的值為 _。( True)36、列表 x = 1, 2,執(zhí)行語句 y = x: 后,表達式x is not y 的值為。 ( True)37、表達式 sorted(range(5), 5) 的值為 。(0, 1, 2, 3, 4)38、表達式 i for i in range(10) if i8 的值為 。 ( 9)39、有列表 x = 1, 2, 3, 4, 5, 6,那么表達式rowi for row in x for i inrange(len(x0) 的值為 。 ( 1, 4, 2, 5, 3, 6 )40、執(zhí)行語句 x,y,z = m

8、ap(str, range(3)之后,變量 y 的值為。( 1)41、列表x = 1,2,那么執(zhí)行語句(3)之后,x的值為。( 1,2, 3)42、列表x = 1,2,那么執(zhí)行語句 (3)之后,x的值為。(1,2, 3)43、表達式 print(0b10101) 的值為 。( 21)44、x = 1,2, 3, 4, 5,那么執(zhí)行語句del x:3之后,x的值為。( 4, 5)45、 x = range(1,4)和 y = range(4,7),那么表達式sum(i*j for i,j in zip(x,y) 的值為。( 32)46、表達式5 for i in range(3)的值為 。( 5

9、, 5, 5)47、表達式1, 2, 3 = 1, 3, 2的值為 。( True)48、表達式1, 2, 3 = 1, 3, 2的值為 。( False)49、 x= 1, 2, 1,那么表達式id(x0)= id(x2)的值為 。 ( True)50、表達式3 not in 1, 2, 3 的值為_。( False)51 、 x= 1, 2,那么執(zhí)行語句x0:0 =3, 3 之后,x 的值為 。 (3, 3, 1,2)52、 x= 1, 2,那么執(zhí)行語句x0:1 =3, 3 之后,x 的值為 。( 3, 3, 2)53、x = 1,2, 3, 4, 5,那么執(zhí)行語句 del x1:3之后,

10、x的值為。(1,4, 5)54、 x = 1, 2, 3, 4, 5, 6 ,那么表達式 sum(i*j for i,j in zip(*x) 的值為 。( 32)55、列表 x = 1, 2, 3 和 y = 4, 5, 6,那么表達式 (i,j) for i, j in zip(x,y) if i=3 的值為。( (3, 6)56、列表 x = , , ,那么表達式 sum(x)/len(x) 的值為 _。()57、 x = 1:2, 2:3, 3:4,那么表達式 sum(x) 的值為 。 ( 6)58、 x = 1:2, 2:3, 3:4,那么表達式 sum() 的值為 。 ( 9)59

11、、 x = 3, 2, 3, 3, 4,那么表達式 index for index, value in enumerate(x) if value=3的值為 。 ( 0, 2, 3)60、表達式 1234%1000oin(item1 for item in () 的值為 。 ( 345)61、列表 x = 1, 3, 2,那么表達式 value for index, value in enumerate(x) if index=2的值為 。( 2)62、列表 x = 1, 3, 2,那么執(zhí)行語句a, b, c = sorted(x) 之后, b 的值為 。( 2)63、列表 x = 1, 3,

12、 2,那么執(zhí)行語句 a, b, c = map(str,sorted(x) 之后, c 的值為。( 3 )64、表達式 set(1,2,3) = 1, 2, 3 的值為 。 ( True)65、表達式 set(1,2, 2,3) = 1, 2, 3 的值為 。( True)66、表達式 %c%65 = str(65) 的值為 。( False)67、表達式 %s%65 = str(65) 的值為 。( True)68、表達式 chr(ord(bF32)的值為。(B)69、表達式 abc in abdcefg 的值為 。 ( False)70、 x 為整數變量, 那么表達式 int(hex(x)

13、, 16) = x 的值為 。 (True)71、 x, y = 3, 5,那么執(zhí)行 x, y = y, x 之后, x 的值為 。 ( 5)72、 x = abcd 和 y = abcde ,那么表達式 i=j for i,j in zip(x,y) 的值為。( True, True, True, True)73、 x = list(range(20),那么表達式 x-1的值為。( 19)74、x = 3+4j和y = 5+6j,那么表達式 x+y的值為。(8+10j)75、x = 3,那么執(zhí)行 x += 5之后x的值為。( 3, 5)76、 x = 3, 3, 4,那么表達式 id(x0)

14、=id(x1) 的值為 。 ( True)77、表達式 int(11, 2)的值為 。( 3)78、表達式 int(11, 8)的值為 。(9)79、表達式 int(bin(54321), 2) 的值為 。( 54321)80、表達式 chr(ord(A)+1) 的值為 。( B)81、表達式 int(str(34) = 34 的值為 。( True)82、表達式 list(str(3, 4) = 3, 4 的值為 。( False)83、表達式1,2, 3, 4, 5, 6 A 5, 6, 7, 8的值為。( 1,2, 3, 4, 7, 8)84、表達式 15 alues()的值為。( 3,

15、 9, 78)85、x = 3, 2, 4, 1,那么執(zhí)行語句 x =()之后,x的值為。( None)86、表達式 list(filter(lambda x: x5, range(10) 的值為 。( 6, 7, 8, 9)87、 x = list(range(20),那么語句 print(x100:200)的輸出結果為 。)88、 x =list(range(20),那么執(zhí)行語句x:18=后列表x的值為 。( 18, 19 )89、 x= 1, 2, 3,那么連續(xù)執(zhí)行y = x:和(4)這兩條語句之后,x 的值為 。( 1, 2, 3)90、 x= 1, 2, 3 ,那么連續(xù)執(zhí)行y = x

16、 和 (4)這兩條語句之后,x 的值為。(1, 2, 3, 4)91 、 x= 1, 2, 3,那么連續(xù)執(zhí)行 y = 1, 2, 3和(4)這兩條語句之后,x 的值為。(1, 2, 3)92、 x =* 3 ,那么執(zhí)行語句x0.append(1)之后,x的值為。(1, 1, 1 )93、 x = for i in range(3) ,那么執(zhí)行語句 x0.append(1) 之后, x 的值為。( 1, , )94、 x = (1, 2),那么執(zhí)行語句 xO.append(3)后 x 的值為。(1,3, 2)95、x= 1:1,2:2,那么執(zhí)行語句(2:3, 3:3)之后,表達式sorted。)

17、的值為。(1, 1), (2, 3), (3, 3)96、x= 1:1,2:2,那么執(zhí)行語句 x3 = 3之后,表達式sorted。)的值為。(1, 1), (2, 2), (3, 3)97、 x = 1,2, 3,那么表達式 not (set(x*100)-set(x)的值為。(True)98、 x = 1, 2, 3,那么表達式 not (set(x*100)&set(x) 的值為。( False)99、表達式x: 1, *y: 2的值為。( x: 1, y: 2)100、表達式*range(4), 4, *(5, 6, 7)的值為。( 0, 1,2, 3, 4, 5, 6, 7)101

18、、已 知 x = 1,2,3,4,5 , 那 么 執(zhí) 行 語 句 x:2 = range(3) 之 后 , x 的 值 為。( 0, 2, 1, 4, 2)102、 x = 1,2,3,4,5 ,那么執(zhí)行語句 x:2 = map(lambda y:y!=5,range(3) 之后, x 的值為。( True, 2, True, 4, True)103、 x = 1,2,3,4,5 ,那么執(zhí)行語句 x1:2 = sorted(x1:2, reverse=True) 之后, x 的值為。( 1, 4, 3, 2, 5)104、105、表達式 True*3 的值為 。 3。 1 表達式False+1

19、 的值為 第3章選擇結構與循環(huán)結構106、表達式ab in acbed 的值為 _ 。( False)107、假設 n為整數,那么表達式 n&1 = n%2 的值為 。( True)108、關鍵字用于測試一個對象是否是一個可迭代對象的元素。in)109、表達式32 的值為 。 True110、 x= a:b, c:d ,那么表達式a in x 的值為 _。 True111、 x= a:b, c:d ,那么表達式b in x 的值為 _。 False112、 x= a:b, c:d ,那么表達式b in () 的值為 _ 。 True113、表達式126 else 6 if 32 else 5

20、的值為 。 6125、Python 關鍵字 elif 表示 和 兩個單詞的縮寫。 else、 if 126、表達式 3 in 1, 2, 3 的值為 。 True127 、 表達式 ac in abce 的值為 。 False128 、 表達式 not 3 的值為 。 False第 4 章 字符串與正那么表達式129、表達式 abc in abcdefg 的值為 。 True130、表達式 abc in abcdefg 的值為 。 False131、表達式 x41 = A 的值為 。 True132、Python 語句 .joinlisthello world! 執(zhí)行的結果是 。 hellow

21、orld! 133、轉義字符 rn 的含義是 。回車換行134、列表對象 x = 11, 2, 3 ,那么表達式max(x) 的值為 _。 3135、表達式 min(11, 2, 3) 的值為 。 11 136、列表對象 x = 11, 2, 3 ,那么表達式max(x, key=len) 的值為 _。 11 137 、 path = rc: ,那么表達式 path:-4+htm 的值為 。( c: )138、表達式 list(str(1,2,3) = 1,2,3 的值為 。 False139、表達式 str(1, 2, 3) 的值為 _ 。( 1, 2, 3)140、表達式 str(1, 2

22、, 3) 的值為 _。( (1, 2, 3)141、表達式 sum(range(1, 10, 2) 的值為 _。 25142、表達式 sum(range(1, 10) 的值為 _。 45143、表達式 %c%65 的值為 。 A 144、表達式 %s%65 的值為 。 65 145、表達式 %d,%c % (65, 65) 的值為 。(65,A)146、表 達 式 The first:1, the secondis 0.format(65,97) 的 值 為 。( The first:97, the second is 65 )147、表達式 0:#d,0:#x,0:#o.format(65)

23、 的值為 _。( 65,0x41,0o101 )148、表達式 isinstance(abcdefg, str) 的值為 。 True149、表達式 isinstance(abcdefg, object) 的值為 。 True150、表達式 isinstance(3, object) 的值為 _。( True)151、表達式 abcabcabc.rindex(abc) 的值為 。 6152、表達式 :.join(abcdefg.split(cd) 的值為 。( ab:efg )153、表達式 Hello world. I like Python.rfind(python)的值為 。 -1154

24、、表達式 abcabcabc.count(abc) 的值為 。 3155、表達式 ,banana,pear.find(p) 的值為 。 1156、表達式 ,banana,pear.find(ppp) 的值為 _。 -1 157、表達式 abcdefg.split(d) 的值為 。( abc, efg )158、表達式 :.join(1,2,3,4,5.split(,) 的值為 。( 1:2:3:4:5 )159 、 表達式 ,.join(a b cccnnnddd .split() 的值為 。( a,b,ccc,ddd )160、表達式 Hello world.upper() 的值為 。( H

25、ELLO WORLD)161、表達式 Hello world.lower() 的值為 。( hello world )162、表達式 Hello world.lower().upper() 的值為 。( HELLO WORLD)163、表達式 Hello world.swapcase().swapcase() 的值為 。( Hello world )164、表達式 rc:windows.endswith(.exe) 的值為 。( True)165 、 表達式 rc:windows.endswith(.jpg, .exe) 的值為 。( True)166 、 表達式 C:Windows.star

26、tswith(C:) 的值為 。( True)167、表達式 len(Hello world!.ljust(20) 的值為 。( 20)168、表達式 len(abcdefg.ljust(3) 的值為 。( 7)169、表達式 a + b 的值為 。( ab )170、 x = 123 和 y = 456,那么表達式 x + y 的值為 。( 123456 )171、表達式 a.join(abc.partition(a) 的值為 。( aaabc )172、表達式 (.+, .gamma.delta) 的值為 。( alpha, beta,gamma, delta )173、 x = a234

27、b123c ,并且 re 模塊 已導入, 那么表達 式 (d+, x) 的值 為。( a, b, c )174、表達式 .join(asdssfff.split(sd) 的值為 。( assfff )175、表達式 .join(sd,asdssfff) 的值為 。( afff )176、假 設 re 模 塊 已 導 入 , 那 么 表 達 式 (d)1+, 33abcd112) 的 值 為 。( 3, 1 )177、語句 print(abc, defg) 輸出結果為 。( None )178 、表達式 Hello world!-4 的值為 _。( r)179、表達式Hello world!-4

28、: 的值為。( rld! )180 、表達式.endswith(.py, .pyw)的值為 。( True)181 、表達式len(abc.ljust(20) 的值為_。( 20)182 、代碼 print(Aa-zA-Zl+$,abcDEFGOOO)的輸岀結果為。(None)183 、當在字符串前加上小寫字母 或大寫字母 _表示原始字符串, 不對其中的任何字符進行轉義。( r、 R)184、 在設計正那么表達式時,字符 緊隨任何其他限定符 (* 、+、 n、n,、n,m)之后時,匹配模式是“非貪心的,匹配搜索到的、盡可能短的字符串。()185、 假設正那么表達式模塊 re 已導入,那么表達式

29、 (d+, 1, a12345bbbb67c890d0e) 的 值為。( a1bbbb1c1d1e )186 、表達式len(中國.encode(utf-8)的值為 _。( 6)187 、表達式len(中國.encode(gbk)的值為 _ 。( 4)188 、表達式chr(ord(A)+2) 的值為 _。( C)189、表達式abcab.replace(a,yy) 的值為 。( yybcyyb )190、 table = .maketrans(abcw,xyzc),那么表達式Hellow world.translate(table)的值為 。( Helloc corld )191 、 表 達

30、 式 hello world, hellow every one.replace(hello, hi) 的 值 為 。( hi world, hiw every one )192、字符串 x = hello world ,那么執(zhí)行語句 (hello, hi) 之后, x 的值為 。( hello world )193 、 正那么表達式元字符 用來表示該符號前面的字符或子模式 1 次或屢次出現(xiàn)。(+)194、 x = a b c d,那么表達式 ,.join()的值為。( a,b,c,d)195、正那么表達式元字符用來表示該符號前面的字符或子模式 0 次或屢次出現(xiàn)。*196、表達式 abcab.

31、strip(ab) 的值為 。 c197、表達式 str(i) for i in range(3) 的值為。( 0, 1, 2 )198、表達式 .endswith(.txt, .doc, .jpg)的值為 。 True199、代碼 print1,2,3,sep=: 的執(zhí)行結果為。( 1:2:3 )200、代碼 for i in range(3):print(i, end=,) 的執(zhí)行結果為 。201、表達式 eval(_import_(math).sqrt(9) 的值為 。()202、表達式 eval(_import_(math).sqrt(3*2+4*2)的值為 。(203、表達式 eva

32、l3+5 的值為 。 8204、表達式 eval(1, 2, 3) 的值為 。( 1, 2, 3)205、假設 math 標準庫已導入,那么表達式eval4 的值為 。206、 x 為非空列表,那么表達式 x in x 的值為 。 True207、表達式 abc10.isalnum() 的值為 。 True208、表達式 abc10.isalpha() 的值為 。 False209、表達式 abc10.isdigit() 的值為 。( False)210、表達式 C:windows.endswith(.exe)的值為 。 True211、表達式 %s%1,2,3 的值為 。( 1, 2, 3

33、)212、表達式 aaasdf.lstrip(as) 的值為 。 df 213、表達式 aaasdf.lstrip(af) 的值為 。( sdf )214、表達式 aaasdf.strip(af) 的值為 。 sd 215、表達式 aaasdf.rstrip(af) 的值為 。( aaasd)216、表達式 lenSDIBT 的值為 _。 50,1,2,)217、表達式 Hello world!.count(l)的值為 。( 3)218、 x = abcdefg,那么表達式 x3: + x:3的值為。( defgabc)219、字符串編碼格式 UTF8使用個字節(jié)表示一個漢字。(3)220、字符

34、串編碼格式GBK使用個字節(jié)表示一個漢字。(2)221、字符串編碼格式utf8 使用 3個字節(jié)表示一個漢字、1 個字節(jié)表示英語字母,那么表達式 len(abc 你好 )的值為 。 ( 5)222、字符串編碼格式utf8 使用 3個字節(jié)表示一個漢字、1 個字節(jié)表示英語字母,那么表達式len(abc你好.encode()的值為。( 9)223、字符串編碼格式gbk使用2個字節(jié)表示一個漢字、1個字節(jié)表示英語字母,那么表達式 len(abc 你好 .encode(gbk) 的值為 。( 7)224、 ord(A)的值為 65并且 hex(65)的值為0x41,那么表達式 x41b的值為。( Ab)225

35、、 formatter = good 0.format ,那么表達式 list(map(formatter, morning) 的值為 。( good morning )226、x = hello world.,那么表達式(x)和(x)的值都為。( -1)227、表達式 :.join(hello world.split() 的值為 。( hello:world. )228、表達式 :.join(a b c d.split(maxsplit=2) 的值為 。 ( a:b:c d)229、 x = hello world,那么表達式(T, g)的值為。 ( heggo worgd)230、假設已成

36、功導入 Python標準庫string ,那么表達式len的值為。(10)231 、表達式 aaaassddf.strip(af) 的值為 。( ssdd)232、表達式 len(aaaassddf.strip(afds) 的值為 。 ( 0)233、表達式 len(hello world100:) 的值為 。 ( 0)234、表達式 chr(ord(a)A32A32)的值為。( a)235、表達式 chr(ord(a)A32)的值為。( A)236、 x = aa b ccc dddd,那么表達式.join(v for i,v in enumerate(x:-1) if v=xi+1)的值為

37、 。( accddd)237、假設正那么表達式模塊 re 已正確導入,那么表達式 .join(d+,abcd1234) 的值為。( 1234)238、假設 正那么表達式模 塊 re 已正確 導入,那么表達式 (d+, abcd1234) 的值 為。( 1, 2, 3, 4 )239、假設正那么表達式模塊 re 已正確導入,那么表達式 (.s)1+, 1,a a a a a bb) 的值為 _ 。( a bb )240、表達式 eval(*.join(map(str, range(1, 6) 的值為 。( 120)241 、正那么表達式模塊re 的 _方法用來編譯正那么表達式對象。(compil

38、e() )242、正那么表達式模塊re 的 _方法用來在字符串開始處進行指定模式的匹配。( match()243、正那么表達式模塊re 的 _方法用來在整個字符串中進行指定模式的匹配。( search()244、表達式 (rw*(Pbw+b)s+(P=f)w*, Beautiful is is better than ugly.).group(0)的值為 。( is is)245、表達式 Beautiful is better than ugly.startswith(Be, 5) 的值為 。( False)246、字典 x = i:str(i+3) for i in range(3) ,那么

39、表達式 .join() 的值為 。( 345 )第5章函數定義與使用247、Python 中定義函數的關鍵字是 。( def)248、在函數內部可以通過關鍵字 來定義全局變量。 (global)249 、 如果函數中沒有 return 語句或者 return 語句不帶任何返回值,那么該函數的返回值為 。 None 250、表達式sum(range(10) 的值為 。(45)251、表達式sum(range(1, 10, 2) 的值為 。(25)252、表達式list(filter(None, 0,1,2,3,0,0) 的值為 。1, 2, 3)253、表達式list(filter(lambda

40、 x:x2, 0,1,2,3,0,0) 的值為 _。( 3 )254、表達式list(range(50, 60, 3) 的值為 _ 。( 50, 53, 56, 59)255、表達式 list(filter(lambda x: x%2=0,range(10)的值為 。( 0, 2, 4, 6, 8)256、表達式list(filter(lambda x: len(x)3, a, b, abcd) 的值為_。( abcd )257、 g= lambda x, y=3, z=5: x*y*z ,那么語句 print(g(1)的輸出結果為 _。15258、表達式list(map(lambda x:

41、len(x), a, bb, ccc) 的值為 _。1, 2, 3)259、 f =lambda x: x+5 ,那么表達式 f3 的值為 _。 8260、表達式sorted(abc, acd, ade, key=lambda x:(x0,x2)的值為 。( abc, acd, ade )261 、 函數定義 def demo(x, y, op):return eval(str(x)+op+str(y) ,那么表達式 demo(3, 5,+)的值為 。( 8)262 、 函數定義 def demo(x, y, op):return eval(str(x)+op+str(y) ,那么表達式 de

42、mo(3, 5,*) 的值為 。( 15)263 、 函數定義 def demo(x, y, op):return eval(str(x)+op+str(y) ,那么表達式 demo(3, 5,-) 的值為 。( -2)264 、 已 知 f = lambda n: len(bin(n)bin(n).rfind(1)+1:) , 那 么 表 達 式 f(6) 的 值 為265、 。( 1 )已 知 f = lambda n: len(bin(n)bin(n).rfind(1)+1:) , 那 么 表 達 式 f(7) 的 值 為266、g = lambda x, y=3, z=5: x+v+乙

43、那么表達式 g2的值為。10267、函數定義def func(*p):return sum(p) ,那么表達式 func(1,2,3) 的值為 _ 。( 6 )268、函數定義def func(*p):return sum(p) ,那么表達式func(1,2,3, 4)的值為_。 10269、函數定義def func(*p):return sum() ,那么表達式 func(x=1, y=2, z=3)的值為。( 6)270 、 函數定義 def func(*p):return .join(sorted(p) ,那么表達式 func(x=1, y=2, z=3) 的值為 。( xyz)271、

44、f = lambda x: 5,那么表達式f(3)的值為。( 5)第6章272、面向對象程序設計Python 使用 關鍵字來定義類。class)273、表達式 isinstance(abc, str) 的值為 _。 True274、表達式 isinstance(abc, int) 的值為 _ 。( False)275、表達式 isinstance(4j, (int, float, complex) 的值為 _。 ( True )276、表達式 isinstance(4, (int, float, complex) 的值為 _。( False)277、表達式 type(3) in (int, f

45、loat, complex) 的值為 。 True278、表達式 type in (int, float, complex) 的值為 。 True279、表達式 type(3+4j) in (int, float, complex) 的值為 。 True280、表達式 type(3) in (int, float, complex) 的值為 。( False)281 、表達式 type3 = int 的值為 。 True282、在 Python 定義類時,與運算符“ * 對應的特殊方法名為 。_pow_ 1、 在 Python 中定義類時,與運算符“ hl 的文件直接安裝 Python 擴展庫

46、。對2、 只有 Python 擴展庫才需要導入以后才能使用其中的對象, Python 標準庫不需要導入即 可使用其中的所有對象和方法。錯3、在 Python 中 0xad 是合法的十六進制數字表示形式。對4、3+4j 是合法 Python 數字類型。對5、在 Python 中 0oa1 是合法的八進制數字表示形式。錯6、Python 使用縮進來表達代碼之間的邏輯關系。對7、Python 代碼的注釋只有一種方式,那就是使用#符號。錯8、放在一對三引號之間的任何內容將被認為是注釋。錯9、盡管可以使用 import 語句一次導入任意多個標準庫或擴展庫, 但是仍建議每次只導入一 個標準庫或擴展庫。對10、為了讓代碼更加緊湊,編寫 Python 程序時應盡量防止參加空格和空行。錯11、在 Python 中運算符 +不僅可以實現(xiàn)數值的相加、字符串連接

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論