• Why does one work but other does not?

Question related to mission Even the Last

 

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