array =[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]
def checkio(array):
if len(array)>0:
(sum (array[0:len(array):2])) * array [-1]
else :
return 0
结果总是为0。这是什么问题?
答案 0 :(得分:0)
array =[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]
def checkio(array):
if len(array)>0:
return (sum (array[0:len(array):2])) * array[-1]
else :
return 0
您错过了if
阻止的退货声明。