40
Awesome Team
Alexander Lyabah
http://www.checkio.org/user/oduvan/
Last seen 1 day ago
Member for 13 years, 10 months, 21 days
Difficulty Easy
love it!
Not bad. I hope solutions of other players showed you how better it can be solved
More
I can't resist of giving +5 for well commented solution + namedtuple
Very educational. Thank you
More
what a spoiler in solution title :)
More
чтобы не делать вот такую лестницу из if-ов
def checkio(data: str) -> bool:
if len(data)>=10:
if re.search(r"[A-Z]", data):
if re.search(r"[a-z]", data):
if re.search(r"[0-9]", data):
return True
else:
More
HUM = self.human.h_quotes
ROB = self.robot.r_quotes
не надо капслочить для локальных переменных
More
not bad,
but it is always better to do improrts outside of function
More
if condition:
return True
else:
return False
Can be always replaced by
return condition
More
You can start thinking of better names for variables. For example, ‘a’ can be called ‘words’.
Good naming is also part of the developer’s job.
More
Как вариант к улучшению
Если первое условие заканчивается на `return` то `else` можно не использовать. Поэтому решение можно переписать так
if text.count(symbol) < 2:
return None
x = text.index(symbol) + 1
return text.index(symbol,x)
понимаешь почему?
More
немного по условиям еще подсказка
return None
можно просто заменить на
return
а условия можно просто объединить через `or`
итого это
if text.find(symbol) == -1:
return None
if text.count(symbol) == 1:
return None
можно заменить на
if text.find(symbol)
More
Попробуй еще сделать вариант, где мы проверяем в начале, что есть 2 символа и тогда уже делаем все необходимые вычисления.
More