map and multiple lists
This commit is contained in:
parent
b0a1db1eed
commit
b75d48cff9
1 changed files with 14 additions and 0 deletions
14
mapreduce.py
Normal file
14
mapreduce.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
from __future__ import division, print_function
|
||||
|
||||
import operator
|
||||
|
||||
seq1 = [1, 2, 3]
|
||||
seq2 = ["eins", "zwei", "drei", "vier"]
|
||||
map(lambda x: print("got:", x), seq1)
|
||||
map(lambda x1, x2: print("got:", x1, x2), seq1, seq2)
|
||||
map(lambda *x: print("got:", x), seq1, seq2)
|
||||
print(map(None, seq1, seq2))
|
||||
|
||||
seq3 = [1, 2, 3, 4]
|
||||
print(reduce(operator.mul, seq3))
|
Loading…
Add table
Add a link
Reference in a new issue