单选题

 有关下面Python的代码,错误的是(    )。

def count_if(iterData,*,key=None):

if key == None:

return len(iterData)

Count = 0

for i in iterData:

Count += bool(key(i))

return Count

A

执行 print(count_if(range(100))) 将输出 100

B

执行 print(count_if(range(-10,10), key = abs)) 将输出 19

C

执行 print(count_if(range(-100,10),key = lambda x:x > 5)) 将输出 4

D

代码 Count += bool(key(i)) 存在错误

赣ICP备20007335号-2