Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Everything (except the last point) is wrong in this AI-generated text.
P.S. Do not submit AI-generated solutions.
Проблемы
Регулярное выражение
r'(?=[a-z])([qwrtypsdfghjklzxcvbnm])([a-z])'
— Оно не учитывает пунктуацию и цифры, а также не гарантирует, что будет обрабатывать только слова целиком.
— Символ (?=[a-z]) не нужен, если использовать группы согласных и гласных.
— Флаг re.I делает регистр неважным, но вы пытаетесь обрабатывать регистр вручную, что может привести к ошибкам.
Обработка регистра
— Ваш код предполагает, что первая буква согласных — заглавная, если слово начиналось с заглавной согласной, но не учитывает, что после переноса согласных в конец слово может потерять заглавную букву, если она не первая.
— Не обрабатывается случай, когда слово начинается с гласной и имеет заглавную букву.
Пунктуация и цифры
— Ваш код не сохраняет знаки препинания и не оставляет цифры без изменений.
— Если слово заканчивается пунктуацией, она может быть потеряна или обработана некорректно.
Печать в функции sub
— print(m, m, m) — это для отладки, но не влияет на работу функции.
You're welcome, HNY to you too.
Great thanks! I rewrited the last part of code using iterator and it worked!
Happy New Year!
You should use backticks ` not single quotes for markdown formatting. Anyway, you're mutating the input list as I guessed:
del names[-1]
.This comment is hidden because it contains spoiler information about the solution
Post your code, using markdown formatting and mark your post as having spoiler content.
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'
Are you mutating the input list? If you do, then don't. It'll produce wrong results.
Test Passed
Test Passed
'Sheldon' should equal 'Leonard'
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.
This comment is hidden because it contains spoiler information about the solution