Mbpp/740

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
Base 测试PASS
Plus 测试PASS
代码长度524 字符
模型生成的代码 (524 字符)
def tuple_to_dict(t):
    """
    Convert a tuple to a dictionary by pairing adjacent elements as key-value pairs.
    If the tuple has an odd number of elements, the last element is ignored.
    
    Args:
        t (tuple): Input tuple.
    
    Returns:
        dict: Dictionary formed by pairing consecutive elements.
    
    Example:
        >>> tuple_to_dict((1, 5, 7, 10, 13, 5))
        {1: 5, 7: 10, 13: 5}
    """
    # Create an iterator and use zip to pair elements
    it = iter(t)
    return dict(zip(it, it))
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • 无失败测试