def toggle_doors(doors, skip):
    """Toggle every skip door in doors.

    doors is an array of elements where a false value represents a
    closed door and a true value represents an open door.

    If skip is 1, toggle door #1, #2, #3...
    If skip is 2, toggle door #2, #4, #6...

    Returns doors
    """
    for i in range(skip-1, len(doors), skip):
        if doors[i]:
            doors[i] = 0
        else:
            doors[i] = 1
    return doors