Skip to content

Instantly share code, notes, and snippets.

@nitesh8860
Created June 12, 2020 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nitesh8860/c4bcaef04cf295a2c1269b215e9c86b0 to your computer and use it in GitHub Desktop.
Save nitesh8860/c4bcaef04cf295a2c1269b215e9c86b0 to your computer and use it in GitHub Desktop.
using reduce function
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