Python練習問題2019-5-14 AM
2376 ワード
Python練習問題2019-5-14 AM第一題:以下のコード実行過程を説明する.a = map(lambda x: x**3, [1, 2, 3]) list(a)
第2題:pythonの中の==isと区別しますか?
第三題:pythonの小さな整数オブジェクトプールについて説明します.
第四題:python 2とpython 3のrange()の戻り値の違い?
第五題:bar(2)(3)==8 def bar(multiple):def foo(n):return multiple**n return foo print bar(2)(3)
第六題:python付与式の戻り値は何ですか.
第七題:pythonのsetとlistの違いは?
第八題:pythonの%と%の違いは?
第九題:なぜ%%ではなく%%を使って%を転義するのか、あなたの理解について話します.
第十題:すでにグローバル変数aaがあって、関数の内部に局所変数aaがあって、もし局所変数がglobal修飾を使うならば、どんな方面が異なっていますか?
第十題:pythonのtupleは何ですか.定義方法
第11題:class Person:def init(self):pass def getAge(self):print name p=Person()p.getAge()を分析する
第十二題:pythonのスライスは何ですか.スライスの使用方法
:
: 1,8,27
map() , f,
list, f list ,
list,a**b a b 。
第2題:pythonの中の==isと区別しますか?
:
== ,id 。
is id 。
第三題:pythonの小さな整数オブジェクトプールについて説明します.
:
,python 【-5,256】 ,
。
,
,
。
第四題:python 2とpython 3のrange()の戻り値の違い?
:
python2 ,
python3 。
,
list() 。
第五題:bar(2)(3)==8 def bar(multiple):def foo(n):return multiple**n return foo print bar(2)(3)
:
。
,
bar 。
bar(2) , foo ,
3, foo(3)。 2**2 -> 8
第六題:python付与式の戻り値は何ですか.
:
python ,
C/C++ , 。
第七題:pythonのsetとlistの違いは?
:
list , ,
set , 。
, set(list)。
第八題:pythonの%と%の違いは?
:
% ,
%% 。
第九題:なぜ%%ではなく%%を使って%を転義するのか、あなたの理解について話します.
:
, C ,
C ,% ,
%d, \% , ,
%% 。
第十題:すでにグローバル変数aaがあって、関数の内部に局所変数aaがあって、もし局所変数がglobal修飾を使うならば、どんな方面が異なっていますか?
:
global aa 。
: global, 。
第十題:pythonのtupleは何ですか.定義方法
:
tuple , ( ) tuple。
tuple list ,tuple list ,
tuple 。
:tuple , 。
。
第11題:class Person:def init(self):pass def getAge(self):print name p=Person()p.getAge()を分析する
:
:__main__
1、__name__ ,
,
__name__ __main__
, 。
2、__main__ , C ,
, if __name__ == "__main__":
。
第十二題:pythonのスライスは何ですか.スライスの使用方法
:
, 。
list、tuple、str( ) ,
。
: [a:b:c],a ,b ,c 。
a、b , -2, 。