Insertion and Return Position in Sorted List

  • Share this:

Code introduction


This function takes two arguments, one for inserting into a sorted list, and the other returns the list after insertion and the insertion position.


Technology Stack : bisect

Code Type : Function

Code Difficulty : Intermediate


                
                    
def aaaa(arg1, arg2):
    import bisect
    result = bisect.insort([1, 2, 4, 5], arg1)
    return arg2, result                
              
Tags: