def find_last_condition_index(lst, condition):
    """
    查找最后一次出现的符合条件的数据的索引
    """
    return next((len(lst) - n for (n, i) in enumerate(reversed(lst), 1) if condition(i)),
                -1)


def find_first_condition_index(lst, condition):
    """
    查找第一次出现的符合条件的数据的索引
    """
    return next((n for (n, i) in enumerate(lst, 0) if condition(i)),
                -1)


if __name__ == '__main__':
    a = [1, 2, 10, 3, 4, 50, 6, 7, 8, 9]
    result_index = find_last_condition_index(a, lambda i: i > 200)
    print(result_index)