Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
13
Task/Catamorphism/Python/catamorphism.py
Normal file
13
Task/Catamorphism/Python/catamorphism.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
from functools import reduce
|
||||
from operator import add
|
||||
from operator import mul
|
||||
|
||||
def concat(a: int | str, b: int | str) -> str:
|
||||
return str(a) + str(b)
|
||||
|
||||
a = list(range(1, 11))
|
||||
|
||||
print(a)
|
||||
print(f"sum: {reduce(add, a)}")
|
||||
print(f"product: {reduce(mul, a)}")
|
||||
print(f"concat: {reduce(concat, a)}")
|
||||
Loading…
Add table
Add a link
Reference in a new issue