(a)
return unique_in_order, mapping
Return
    - unique elements of the input list (in the order of appearance)
    - indices of the input list onto the returned uniques
Return
    - unique elements of the input list (in the order of appearance)
    - indices of the input list onto the returned uniques
Return - unique elements of the input list ( in the order of appearance ) - indices of the input list onto the returned uniques
def unique_in_order_mapping(a):
    """ Return
    - unique elements of the input list (in the order of appearance)
    - indices of the input list onto the returned uniques
    """
    first_position = {}
    unique_in_order = []
    mapping = []
    for e in a:
        if e not in first_position:
            first_position[e] = len(unique_in_order)
            unique_in_order.append(e)
        mapping.append(first_position[e])
    return unique_in_order, mapping
def unique_in_order_mapping ( a ) : first_position = { } unique_in_order = [ ] mapping = [ ] for e in a : if e not in first_position : first_position [ e ] = len ( unique_in_order ) unique_in_order . append ( e ) mapping . append ( first_position [ e ] ) return unique_in_order , mapping