單項選擇題在Python中,如何判斷一個列表是否為空?()

A.len(list)==0
B.list.isEmpty()
C.not list
D.A和C都對


您可能感興趣的試卷

你可能感興趣的試題

1.單項選擇題在Python中,如何獲取字符串的子串?()

A.str[start:end]
B.str.sub(start,end)
C.str.slice(start,end)
D.str.substring(start,end)

2.單項選擇題在Python中,如何使用三元運算符?()

A.x if condition else y
B.condition ?x :y
C.if condition then x else y
D.condition ->x,y

3.單項選擇題在Python中,如何判斷一個變量是否為None?()

A.var is None
B.var ==None
C.var.isNull()
D.A和B都對

4.單項選擇題在Python中,如何合并兩個字典?()

A.dict1.update(dict2)
B.dict1+dict2
C.dict1.merge(dict2)
D.dict1&&dict2

5.單項選擇題在Python中,如何創(chuàng)建一個只讀屬性?()

A.@property
B.readonly
C.const
D.immutable