Mbpp/479

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
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 失败测试用例
  • 无失败测试