For something as simple as a sum of an array, 7 lines of code seem quite a lot.
In your example it's 7 lines vs 4 lines (a gain of 3 lines, impressive). In a real work example the function could easily be 50 lines of code vs 47 lines of the functional approach, being gain still 3.
You must handle the bounds of the iteration yourself
In JS yes, not in Python:
for number in array :
...
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In your example it's 7 lines vs 4 lines (a gain of 3 lines, impressive). In a real work example the function could easily be 50 lines of code vs 47 lines of the functional approach, being gain still 3.
In JS yes, not in Python:
for number in array :
...