Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
14
Task/Catamorphism/Python/catamorphism-2.py
Normal file
14
Task/Catamorphism/Python/catamorphism-2.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Python 3.X
|
||||
|
||||
from functools import reduce
|
||||
from operator import add, mul
|
||||
|
||||
nums = range(1,11)
|
||||
|
||||
summation = reduce(add, nums)
|
||||
|
||||
product = reduce(mul, nums)
|
||||
|
||||
concatenation = reduce(lambda a, b: str(a) + str(b), nums)
|
||||
|
||||
print(summation, product, concatenation)
|
||||
Loading…
Add table
Add a link
Reference in a new issue