Mbpp/743

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
Base 测试PASS
Plus 测试PASS
代码长度463 字符
模型生成的代码 (463 字符)
def rotate_right(lst, k):
    """
    Rotates the given list to the right by k positions.
    
    Args:
        lst (list): The input list.
        k (int): Number of positions to rotate to the right.
    
    Returns:
        list: A new list rotated to the right by k positions.
    """
    if not lst:
        return []
    n = len(lst)
    k %= n  # Handle rotations larger than list length
    if k == 0:
        return lst[:]
    return lst[-k:] + lst[:-k]
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • 无失败测试