DEV Community

Discussion on: Day 14 of 100DaysofCode: Finding Numerical Data And Summing Them

Collapse
 
otumianempire profile image
Michael Otu
summ= lambda total: reduce(operator.add, total)
print(summ(total))
Enter fullscreen mode Exit fullscreen mode

Has a typo, summ

In all, you a lambda function. I don't remember the last time I did use a lambda function.

Collapse
 
otumianempire profile image
Michael Otu • Edited

pardon me, I mistook summ as a typo for sum, which is a built-in function that performs the same functionality as the summ. I run your code not long from now.

summ= lambda total: reduce(operator.add, total)
Enter fullscreen mode Exit fullscreen mode

was translated

def summ(total):
    return reduce(operator.add, total)
Enter fullscreen mode Exit fullscreen mode

In all, all is good. Thanks!!

Collapse
 
iamdurga profile image
Durga Pokharel

yeah that's cool