Mbpp/445

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
Base 测试PASS
Plus 测试PASS
代码长度659 字符
模型生成的代码 (659 字符)
def index_multiplication(tup1, tup2):
    """
    Perform index-wise multiplication of elements in two nested tuples.
    
    The function recursively multiplies corresponding elements. If both elements
    are tuples, it returns a new tuple with the same structure where each pair
    of elements is multiplied. Otherwise, it multiplies the two scalar values.
    """
    if isinstance(tup1, tuple) and isinstance(tup2, tuple):
        # Recursively multiply corresponding elements
        return tuple(index_multiplication(a, b) for a, b in zip(tup1, tup2))
    else:
        # Base case: both are numbers (or non-tuple elements)
        return tup1 * tup2
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • 无失败测试