Ad
  • Custom User Avatar

    Everything (except the last point) is wrong in this AI-generated text.

    P.S. Do not submit AI-generated solutions.

  • Custom User Avatar

    Проблемы
    Регулярное выражение
    r'(?=[a-z])([qwrtypsdfghjklzxcvbnm])([a-z])'
    — Оно не учитывает пунктуацию и цифры, а также не гарантирует, что будет обрабатывать только слова целиком.
    — Символ (?=[a-z]) не нужен, если использовать группы согласных и гласных.
    — Флаг re.I делает регистр неважным, но вы пытаетесь обрабатывать регистр вручную, что может привести к ошибкам.

    Обработка регистра
    — Ваш код предполагает, что первая буква согласных — заглавная, если слово начиналось с заглавной согласной, но не учитывает, что после переноса согласных в конец слово может потерять заглавную букву, если она не первая.
    — Не обрабатывается случай, когда слово начинается с гласной и имеет заглавную букву.

    Пунктуация и цифры
    — Ваш код не сохраняет знаки препинания и не оставляет цифры без изменений.
    — Если слово заканчивается пунктуацией, она может быть потеряна или обработана некорректно.

    Печать в функции sub
    — print(m, m, m) — это для отладки, но не влияет на работу функции.

  • Custom User Avatar

    You're welcome, HNY to you too.

  • Custom User Avatar

    Great thanks! I rewrited the last part of code using iterator and it worked!
    Happy New Year!

  • Custom User Avatar

    You should use backticks ` not single quotes for markdown formatting. Anyway, you're mutating the input list as I guessed: del names[-1].

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Post your code, using markdown formatting and mark your post as having spoiler content.

  • Custom User Avatar

    It may seem funny, but my code passed sample tests (3 of 3) only after my hardcode list input. Without it the third test is wrong. By the way without hardcoding my code passes 202 tests of 218. The code is built in such a way, that it doesnt matters what amount of words in the list 'names'

  • Custom User Avatar

    Are you mutating the input list? If you do, then don't. It'll produce wrong results.

  • Custom User Avatar

    Test Passed
    Test Passed
    'Sheldon' should equal 'Leonard'

  • Custom User Avatar

    What's the input value? Are you sure you're not confusing one test with the following one? The log appears above the test result.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution