◐ Shell
clean mode source ↗

[3.13] gh-145269: simplify bisect.bisect doc example (GH-145270) by miss-islington · Pull Request #145368 · python/cpython

Expand Up @@ -203,9 +203,9 @@ example uses :py:func:`~bisect.bisect` to look up a letter grade for an exam sco based on a set of ordered numeric breakpoints: 90 and up is an 'A', 80 to 89 is a 'B', and so on::
>>> def grade(score, breakpoints=[60, 70, 80, 90], grades='FDCBA'): ... i = bisect(breakpoints, score) ... return grades[i] >>> def grade(score) ... i = bisect([60, 70, 80, 90], score) ... return "FDCBA"[i] ... >>> [grade(score) for score in [33, 99, 77, 70, 89, 90, 100]] ['F', 'A', 'C', 'C', 'B', 'A', 'A'] Expand Down