can someone explain why this code works:
def checkio(array):
for x in range(0, len(array), 2):
return sum(array[::2]) * array[-1]
if len(array) == 0:
return 0
but this does not?:
def checkio(array):
return sum(array[::2]) * array[-1]
if len(array) == 0:
return 0
I guess i just dont understand why the for loop is there or why x isnt defined anyplace
Created at: 2020/01/30 23:15; Updated at: 2020/01/31 00:58