Mbpp/265

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
Base 测试PASS
Plus 测试PASS
代码长度634 字符
模型生成的代码 (634 字符)
def list_split(lst, n):
    """
    Splits a list into n sublists by taking every nth element in a round-robin fashion.

    Args:
        lst (list): The input list to split.
        n (int): The number of sublists to create.

    Returns:
        list of lists: A list containing n sublists, where the i-th sublist contains
                       elements from lst at indices congruent to i modulo n.
    """
    # Create n empty sublists
    result = [[] for _ in range(n)]
    # Distribute elements into sublists based on their index modulo n
    for i, item in enumerate(lst):
        result[i % n].append(item)
    return result
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • 无失败测试