Skip to content

Commit 48fd30b

Browse files
author
Mofan Zhou
committed
create basic29
1 parent 6a16fa7 commit 48fd30b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

basic/29_zip_lambda_map.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
a = [1,2,3]
2+
b = [4,5,6]
3+
4+
# for zip
5+
list(zip(a,b))
6+
list(zip(a,a,b))
7+
for i, j in zip(a,b):
8+
print(i,j)
9+
10+
#for lambda
11+
def f1(x,y):
12+
return x+y
13+
f2= lambda x, y : x + y
14+
print(f1(1,2))
15+
print(f2(1,2))
16+
17+
# for map
18+
print(list(map(f1, [1],[2])))
19+
print(list(map(f2, [2,3],[4,5])))

0 commit comments

Comments
 (0)