bisect.bisect_right()
bisect.bisect_right() is a Python function in the Bisect Module category. Returns the insertion point for x, keeping rightmost position on ties. The syntax is bisect.bisect_right(a, x, lo=0, hi=len(a)). Returns: Insertion index. A typical example: bisect.bisect_right([1, 3, 3, 5], 3) # 3 (rightmost). A close sibling is bisect.bisect_left(), which returns the insertion point for x in sorted list a, keeping leftmost position on ties. A close sibling is bisect.insort_left(), which inserts x into sorted list a at the leftmost position. A close sibling is bisect.insort_right(), which inserts x into sorted list a at the rightmost position. More about this category: Array bisection algorithm — bisect_left, insort, bisect_right. Related Bisect Module entries: bisect.bisect_left(), bisect.insort_left(), bisect.insort_right(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try bisect.bisect_right() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.