Iterating over a list in a function


#1



I just completed the exercise now..but can anyone please give me brief explanation about this..


 for number in range(len(numbers)):
        result += numbers[number]
    return result


#2

you loop over numbers using range which gives you indexes, you use this indexes to get items from numbers list, which you then add to result


#3

Thank you. I understood!


#4