测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | PASS |
| 代码长度 | 472 字符 |
模型生成的代码 (472 字符)
def swap_List(lst):
"""
Interchanges the first and last elements of a list.
Parameters:
lst (list): Input list.
Returns:
list: A new list with the first and last elements swapped.
If the list has 0 or 1 elements, a copy of the original list is returned.
"""
if len(lst) <= 1:
return lst[:] # Return a copy to preserve original
# Swap first and last elements using slicing
return [lst[-1]] + lst[1:-1] + [lst[0]]
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
- 无失败测试