Created
June 12, 2020 15:15
-
-
Save nitesh8860/c4bcaef04cf295a2c1269b215e9c86b0 to your computer and use it in GitHub Desktop.
using reduce function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import reduce | |
l=[1,2,3,4] | |
print(reduce(lambda x,y: x*y, l, -1)) | |
#> -24 | |
#reduce(func with 2 params, iterable, initial value ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment