python
import py
data = [1, 2, 3, 4, 5]
result = (
py(data)
.select(lambda x: x > 2)
.map(lambda x: x * 2)
.tolist()
)
with open('data.txt', 'r') as file:
result = (
py(file)
.split()
.groupby(lambda x: x)
.count()
.items()
)
x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]
result = (
py(x)
.zip(y)
.map(lambda x: x[0] * x[1])
.reduce(lambda x, y: x + y, parallel=True)
)
bash
pip install pythonpy