Mbpp/101

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
Base 测试PASS
Plus 测试PASS
代码长度446 字符
模型生成的代码 (446 字符)
def kth_element(arr, k):
    """
    Returns the k-th element of the array using 1-based indexing.
    
    Parameters:
    arr (list): The input array.
    k (int): 1-based index of the element to retrieve.
    
    Returns:
    The element at the k-th position (1-based).
    
    Example:
    >>> kth_element([12, 3, 5, 7, 19], 2)
    3
    """
    if k < 1 or k > len(arr):
        raise IndexError("k is out of bounds")
    return arr[k - 1]
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • 无失败测试