Mbpp/278

⚠️ 仅 Base 通过 Base: PASS Plus: FAIL
测试评估
指标结果
Base 测试PASS
Plus 测试FAIL
代码长度371 字符
模型生成的代码 (371 字符)
def count_first_elements(tup):
    """
    Returns the number of elements that occur before the first tuple element
    in the given tuple. If no tuple element is found, returns -1.
    
    Example:
    >>> count_first_elements((1, 5, 7, (4, 6), 10))
    3
    """
    for i, elem in enumerate(tup):
        if isinstance(elem, tuple):
            return i
    return -1
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • [[1, 2, 3, 4, 5, 6]]