task2.py 646 Bytes
def check_valid_coord(coord, board):
    """
    Check whether the coordinates are valid on a board.
    
    Args:
        coord (tuple[int, int]): coordinates.
        board (list[list[bool]]): ship or hit board.
    
    Returns:
        bool: True if the coordinates are valid, False otherwise.
    """
    x = coord[0]
    y = coord[1]

    # TODO: complete this function to return a boolean expression indicating
    # whether or not the coordinates are valid / located on the board. Remember
    # not to hardcode the size of the board and that several conditions need to
    # all be fulfilled. Hint: our solution is a 1-liner.
    return