I've been playing about with my code in this exercise to try and work out why it's necessary to initialize the variable 'total = 0' before the 'for' loop.
When I change 0 to 10, the output predictably increases by 10.
But when I remove the 'total = 0' altogether, the code still runs, but ends up doubling the final figure.
My question is; why does this happen? I can't understand any logic.
I've been guided to the link below, but can't make head or tail of if. Can anyone explain in simple terms?