Skip to content

Commit 11617d5

Browse files
[3.13] Fix argument order in multinomial() example (gh-132557) (gh-132560)
1 parent 6d48194 commit 11617d5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Doc/library/itertools.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,8 +1129,8 @@ The following recipes have a more mathematical flavor:
11291129

11301130
def multinomial(*counts):
11311131
"Number of distinct arrangements of a multiset."
1132-
# Counter('abracadabra').values() -> 5 2 1 1 2
1133-
# multinomial(5, 2, 1, 1, 2) → 83160
1132+
# Counter('abracadabra').values() 5 2 2 1 1
1133+
# multinomial(5, 2, 2, 1, 1) → 83160
11341134
return prod(map(comb, accumulate(counts), counts))
11351135
11361136

@@ -1736,7 +1736,7 @@ The following recipes have a more mathematical flavor:
17361736
>>> ''.join(it)
17371737
'DEF1'
17381738

1739-
>>> multinomial(5, 2, 1, 1, 2)
1739+
>>> multinomial(5, 2, 2, 1, 1)
17401740
83160
17411741
>>> word = 'coffee'
17421742
>>> multinomial(*Counter(word).values()) == len(set(permutations(word)))

0 commit comments

Comments
 (0)