Created
March 30, 2024 22:55
-
-
Save normanlmfung/be420df8c1ce7ec25b20ee5ff46d0b2e to your computer and use it in GitHub Desktop.
python_syntax_reduce
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 | |
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