13 y there has to have a total = 1


#1

why those kind of exercise need total = 0 or total =1

what's the purpose


#2

When we plan to do augmentation assignments or adjustments to a variable's numerical value, it needs to have a starting, or initialized value.

def product(a):
    for i in range(len(a)):
        total *= a[i]
    return total
print(product([2,3,3]))

Error message:

UnboundLocalError: local variable 'total' referenced before assignment

Because total is not defined, attempting to perform math on it is undefined.