|
|
@ -436,6 +436,14 @@ from itertools import combinations, combinations_with_replacement, permutations, |
|
|
|
``` |
|
|
|
|
|
|
|
```python |
|
|
|
>>> product([0, 1], repeat=3) |
|
|
|
[(0, 0, 0), (0, 0, 1), (0, 1, 0), (0, 1, 1), |
|
|
|
(1, 0, 0), (1, 0, 1), (1, 1, 0), (1, 1, 1)] |
|
|
|
|
|
|
|
>>> product('ab', '12') |
|
|
|
[('a', '1'), ('a', '2'), |
|
|
|
('b', '1'), ('b', '2')] |
|
|
|
|
|
|
|
>>> combinations('abc', 2) |
|
|
|
[('a', 'b'), ('a', 'c'), ('b', 'c')] |
|
|
|
|
|
|
@ -448,14 +456,6 @@ from itertools import combinations, combinations_with_replacement, permutations, |
|
|
|
[('a', 'b'), ('a', 'c'), |
|
|
|
('b', 'a'), ('b', 'c'), |
|
|
|
('c', 'a'), ('c', 'b')] |
|
|
|
|
|
|
|
>>> product('ab', '12') |
|
|
|
[('a', '1'), ('a', '2'), |
|
|
|
('b', '1'), ('b', '2')] |
|
|
|
|
|
|
|
>>> product([0, 1], repeat=3) |
|
|
|
[(0, 0, 0), (0, 0, 1), (0, 1, 0), (0, 1, 1), |
|
|
|
(1, 0, 0), (1, 0, 1), (1, 1, 0), (1, 1, 1)] |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|