You are viewing a single comment's thread. Return to all comments →
Can be done in python as well
print reduce((lambda x, y: x + y ), arr)
could you explain what this line is doing please? Thanks
Reduce just takes a list of values and applies the lambda function to them to get one value at the end. Look up "reduce" in the python docs, or pretty much any website has a good explanation.
Why not just use?
at python3, you net add import as follow:
from functools import reduce