Skip to content

Commit 2d054dc

Browse files
committed
新增列表子元素算术运算
1 parent ccfee03 commit 2d054dc

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test/test_dict.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@ def test_03():
4242
print dict(zip(list_a[::-1], list_b))
4343

4444

45+
def test_04():
46+
"""
47+
测试列表子元素算术运算
48+
:return:
49+
"""
50+
a = [1, 2, 3]
51+
b = [4, 5, 6]
52+
c = [a[i] + b[i] for i in range(min(len(a), len(b)))]
53+
print c
54+
55+
4556
def test_group():
4657
"""
4758
测试分组
@@ -99,6 +110,7 @@ def test_group():
99110
test_01()
100111
test_02()
101112
test_03()
113+
test_04()
102114
test_group()
103115

104116

0 commit comments

Comments
 (0)