Mbpp/131

❌ 均未通过 Base: FAIL Plus: FAIL
测试评估
指标结果
Base 测试FAIL
Plus 测试FAIL
代码长度484 字符
模型生成的代码 (484 字符)
def reverse_vowels(s: str) -> str:
    """
    Reverses only the vowels in the given string.
    The letter 'y' is not considered a vowel.
    """
    vowels = set("aeiouAEIOU")
    chars = list(s)
    left, right = 0, len(chars) - 1

    while left < right:
        if chars[left] not in vowels:
            left += 1
        elif chars[right] not in vowels:
            right -= 1
        else:
            chars[left], chars[right] = chars[right], chars[left]
            left += 1
Base 失败测试用例
  • ['Python']
Plus 失败测试用例
  • ['']