from typing import List


def recall_at_k(ranks: List[int], k: int) -> float:
    """Computes the percentage of comparative sets where the positive image has a rank of <= k

    Args:
        ranks: List of ranks of the positive example in each comparative set
        k: Threshold below which the rank should be counted as true positive

    Returns: Percentage of comparative sets with rank <= k

    """
    below_threshold = [x for x in ranks if x <= k]
    percent_in_top_k = round(100.0 * len(below_threshold) / len(ranks), 1)
    return percent_in_top_k