Mbpp/101

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
Base 测试PASS
Plus 测试PASS
代码长度436 字符
模型生成的代码 (436 字符)
def kth_element(arr, k):
    """
    Return the k-th element of the array using 1-based indexing.

    Parameters:
    arr (list): The input list of elements.
    k (int): The 1-based index of the element to retrieve.

    Returns:
    The k-th element of the array, or None if k is out of bounds.
    """
    # Validate that k is within the valid range
    if 1 <= k <= len(arr):
        return arr[k - 1]
    else:
        return None
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • 无失败测试