def generate_data_and_constant_predictions(n, frac_positive):
    """
    Generates data in a fixed positive:negative ratio, and returns the
    data and scores from a dummy model that predicts 0.5 for all examples.

    Parameters
    ----------
    n : int
        Number of examples

    frac_positive : float
        Fraction of the examples that are positive

    Returns
    -------
    observations : list
        Consisting of (frac_positive * n) 1s, and (n - (frac_positive * n)) 0s

    constant_predictions : list
        Same length as observations
    """
    n_positive = int(frac_positive * n)
    n_negative = n - n_positive
    observations = [1 for _ in range(n_positive)] + \
                   [0 for _ in range(n_negative)]
    constant_predictions = [0.5 for _ in range(n_positive + n_negative)]
    return observations, constant_predictions