Skip to content

Commit 0d55ebb

Browse files
author
chengxianhuan
committed
2 parents d182f6c + 32427c5 commit 0d55ebb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+147
-3
lines changed

.DS_Store

-28 KB
Binary file not shown.

README.md

Lines changed: 7 additions & 3 deletions

day-039/.DS_Store

6 KB
Binary file not shown.

day-039/itertools-chain-demo.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import itertools
2+
x = itertools.chain("abc", "xyz")
3+
print(list(x))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import itertools
2+
print(list(itertools.combinations("abc", r=2)))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import itertools
2+
print(list(itertools.combinations_with_replacement("abc", r=2)))

day-039/itertools-compress-demo.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import itertools
2+
data = [81, 82, 84, 76, 64, 78]
3+
tf = [1,1,0,1,1,0]
4+
print(list(itertools.compress(data, tf)))

day-039/itertools-count-demo.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import itertools
2+
x = itertools.count(1,2)
3+
for k in x:
4+
print(k, end=", ")

day-039/itertools-cycle-demo.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import itertools
2+
x = itertools.cycle("XYZ")
3+
for k in x:
4+
print(k, end = ", ")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import itertools
2+
x = itertools.dropwhile(lambda x: x < 5, [1,3,5,7,4,2,1])
3+
print(list(x))

0 commit comments

Comments
 (0)