一、填空題
1.python使用符號__#___標示注釋,? 以 __TAB____? ? ? ? ? ? ? 劃分語句塊。
2.python序列類型包括 __list__ 、__tuple____? ? ? ? ? ? 、___range___? ? ? ? ? ? ? 三種;_dict_____? ? ? ? ? ? ? ? ? ? 是python中唯一的映射類型
3.python中可變的數據類型有? ___list___dict___________? ? ? ? ? ? ? ? ? ? ? ? ,不可變數據類型有_int__float___string___tuple___
4.python的數字類型分為? ? ? _____int____? ? ? ? ? ? ? ? ? 、_____long__? ? ? 、? ______float___? ? 、_____complex____? 等子類型
5.設s = "abcdefg", 則s[3]值是___d_____ s[2:4]值是__cd______,s[:5]值是___abcd____,
s[3:]是__defg___ ,s[::-1]值是__gfedcba___,s[::2]值是 _aceg____
二、選擇題
1、關于 python 變量的使用,錯誤的是(B)
A、變量不必事先聲明? ? ? ? B、變量無須先創建和賦值而直接使用
C、變量無須指定類型? ? ? ? D、可以使用del釋放資源
2、下面哪個不是python合法標識符(B)
A、int32? ? ? ? ? ? ? ? B、40XL
C、self? ? ? ? ? ? ? ? ? D、__name__
3、python不支持的數據類型有(A)
A、char? ? ? ? ? ? ? ? B、int
C、float? ? ? ? ? ? ? D、list
4、關于字符串說法錯誤的是(D)
A、字符可以視為長度為1的字符串
B、字符串以\0標志字符串的結束
C、既可以用單引號,也可以用雙引號創建字符串
D、在三引號字符串中可以包含換行回車等特殊字符
三、編程練習
1、計算1+2+3+4+.....+100的和
2、分別打印 a 與 b 加/減/乘/除/冪/商/余數的各個結果(共7個)
a=10
b=3
3、9*9乘法口訣表
4、打印 dict_date 中 value 的年份在 1970~1976的 key
dict_date = {"Led Zeppelin":1969, "Led Zeppelin II": 1969, "Led Zeppelin III": 1970, "Led Zeppelin IV": 1971, "Houses of the Holy":1973, "Physical Graffiti": 1975, "Presence":1976, "In Through the Out Door":1979, "Coda":1982}
作者:loading_miracle
鏈接:http://www.lxweimin.com/p/340caae5b634
來源:簡書
著作權歸作者所有。商業轉載請聯系作者獲得授權,非商業轉載請注明出處。