Python celah biner

def solution(N):
    my_binary = format(N, "b")
    my_list = list(my_binary)
    keeper = []
    count = 0
    print(my_binary)
    for x in range(len(my_list)):
        if my_list[x] == '1':
            if x == len(my_list) - 1 or my_list[x + 1] == '1':
                pass
            else:
                keeper.append(changer(x, my_list))

        for q in keeper:
            if q == 0:
                pass
            elif count < (q[1] - q[0]):
                count = q[1] - q[0]
    return count


def changer(x, my_list):
    for y in range(x, len(my_list)):
        if my_list[y] == '0' and y != len(my_list) - 1 and my_list[y + 1] == '1':
            return [x, y]
    return 0

print(solution(11))
Headache reliver