Fix random sample call in good_dates function for 3.12 requirement

This commit is contained in:
Peter Norvig authored and GitHub committed 2026-10-05 12:51:22 -07:00
1 parent bfcdac7e2c
commit f489ad80ed
1 file changed
+1 -1
+1 -1
View File
@@ -328,7 +328,7 @@
"def good_dates(puzzle, n=10) -> BeliefState:\n", "def good_dates(puzzle, n=10) -> BeliefState:\n",
" \"\"\"Pick a set of `n` dates for which the `puzzle` has a unique solution.\"\"\"\n", " \"\"\"Pick a set of `n` dates for which the `puzzle` has a unique solution.\"\"\"\n",
" while True:\n", " while True:\n",
" random_dates = set(random.sample(many_dates, n))\n", " random_dates = set(random.sample(tuple(many_dates), n))\n",
" if know(puzzle(random_dates)):\n", " if know(puzzle(random_dates)):\n",
" return random_dates" " return random_dates"
] ]