Mbpp/730

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
Base 测试PASS
Plus 测试PASS
代码长度506 字符
模型生成的代码 (506 字符)
def consecutive_duplicates(lst):
    """
    Removes consecutive duplicates from a list, keeping only the first occurrence
    in each consecutive group of equal elements.
    
    Args:
        lst: List of elements (any type that supports equality comparison).
    
    Returns:
        A new list with consecutive duplicates removed.
    """
    if not lst:
        return []
    result = [lst[0]]
    for item in lst[1:]:
        if item != result[-1]:
            result.append(item)
    return result
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • 无失败测试