Codewars "Find the Parity Outlier" code
The code in the post, and the code in the answers by Joe Wallis and 200_success, traverses the whole of the input to collect the parities of all the items. But it is easy to return the result as soon as the outlier has been identified, avoiding a wasted traversal of the remainder of the input.

def outlier(it):
    """Given an iterable with at least 3 items, all of which have the
    same parity except for a single outlier, return the outlier.

    """
    count, item = [0, 0], [None, None]
    for n in it:
        parity = n % 2
        if count[parity] == 0 and count[1 - parity] &gt;= 2:
            return n
        elif count[1 - parity] == 1 and count[parity] &gt;= 1:
            return item[1 - parity]
        count[parity] += 1
        item[parity] = n
    else:
        raise ValueError("bad iterable")