Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save normanlmfung/be420df8c1ce7ec25b20ee5ff46d0b2e to your computer and use it in GitHub Desktop.
Save normanlmfung/be420df8c1ce7ec25b20ee5ff46d0b2e to your computer and use it in GitHub Desktop.
python_syntax_reduce
from functools import reduce
numbers = [1, 2, 3, 4, 5]
sum_result = reduce(lambda x, y: x + y, numbers)
print("Sum of the numbers:", sum_result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment