Resolved: Understanding rolling sum & variable of increment
For below function, I can't understand why we created a variable Total to equal zero & why we further increment it by 1. Our aim is to count existing numbers less than 20 so what is the necessity of growing the total by 1.
for x in numbers:
Thanks for reaching out.
total is initialized to 0 and is used to keep track of the count of numbers less than 20. Each time a number in the list
numbers is found to be less than 20, the
total variable is incremented by 1 to reflect this count.
Hope this helps.