]> granicus.if.org Git - python/commitdiff
Make the example cut and pasteable.
authorRaymond Hettinger <python@rcn.com>
Fri, 27 Apr 2012 16:55:31 +0000 (09:55 -0700)
committerRaymond Hettinger <python@rcn.com>
Fri, 27 Apr 2012 16:55:31 +0000 (09:55 -0700)
Doc/library/bisect.rst

index 27ab526efb1180ff1bd221198c22cc95c964519b..64a362eb93152cf3ebfcdb28df49a86cdfd94969 100644 (file)
@@ -123,9 +123,9 @@ 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]
-   ...
+           i = bisect(breakpoints, score)
+           return grades[i]
+
    >>> [grade(score) for score in [33, 99, 77, 70, 89, 90, 100]]
    ['F', 'A', 'C', 'C', 'B', 'A', 'A']