First true

flags is a list of booleans that is False for a while and then True for the rest, like [False, False, True, True]. Either part may be empty. Write first_true(flags) that returns the index of the first True, or len(flags) if there is none.

first_true([False, False, True, True])  ->  2
first_true([True])                      ->  0
first_true([False, False])              ->  2

The point is to practise the boundary form of binary search, which is the template for every "search on an answer" problem.

def first_true(flags):
    ...