def average_accuracy(outputs, targets, k=10):
    """
    Computes the average accuracy at k.
    This function computes the average accuracy at k
        between two lists of items.
    Parameters
    ----------
    outputs : list
        A list of predicted elements
    targets : list
        A list of elements that are to be predicted
    k : int, optional
        The maximum number of predicted elements
    Returns
    -------
    score : double
            The average accuracy at k over the input lists
    """
    if len(outputs) > k:
        outputs = outputs[:k]

    score = 0.0
    num_hits = 0.0

    for i, predict in enumerate(outputs):
        if predict in targets and predict not in outputs[:i]:
            num_hits += 1.0
            score += num_hits / (i + 1.0)

    if not targets:
        return 0.0

    return score / min(len(targets), k)