def reciprocal_rank(recommendations, relevant_recommendation, k=None):
    """Reciprocal Rank at k
    Example calls:
    >>> reciprocal_rank([1,2,3], 1) == 1.0
    >>> reciprocal_rank([1,2,3], 2) == 0.5
    >>> reciprocal_rank([1,2,3], 3) == 0.3333333333333333
    >>> reciprocal_rank([1,2,3], 4) == 0
    >>> reciprocal_rank([1,2,3], 3, k=2) == 0
    >>> reciprocal_rank([1,2,3], 2, k=2) == 0.5
    :param recommendations:
    :param relevant_recommendation:
    :param k:
    :return:
    """
    if k is not None:
        recommendations = recommendations[:k]
    if relevant_recommendation in recommendations:
        return 1 / (recommendations.index(relevant_recommendation) + 1)
    return 0
