Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
12
Task/Catamorphism/Python/catamorphism-2.py
Normal file
12
Task/Catamorphism/Python/catamorphism-2.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
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