Linear Searching for name in Python sorted List of names

Solution 1:

I believe that the intention of this code should check if the first letter is greater, not equal, to the searched name.

So:

def linear_search_sorted(names, search_name):
    length = len(names)
    comp = 0
    for name in names:
        comp += 1
        if name == search_name: 
            return (True, length,comp)
        
        elif name[0] > search_name[0]:
            return (False, length, comp)
    return (False,length, comp)

This returns all your expected results.