测试评估
| 指标 | 结果 |
|---|---|
| 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 失败测试用例
- 无失败测试