测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | PASS |
| 代码长度 | 342 字符 |
模型生成的代码 (342 字符)
def first_Digit(n):
"""
Returns the first (most significant) digit of the given number.
Handles negative numbers by considering their absolute value.
"""
# Take absolute value to handle negatives
num = abs(n)
# Keep dividing by 10 until we get the first digit
while num >= 10:
num //= 10
return num
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
- 无失败测试