40
Awesome Team
Alexander Lyabah
http://www.checkio.org/user/oduvan/
Last seen 23 hours ago
Member for 13 years, 10 months, 21 days
Difficulty Easy
love it!
too many tabs. Same solution but without that many tabs:
def end_zeros(num: int) -> int:
if num == 0:
return 1
if num < 9:
return 0
x = num
y = 0
while x > 9 and x % 10 == 0:
y += 1
x
More
I feel like Python should have something built-in for compose function. I'll try to find. :)
More
на что хочется обратить внимание - такая запись:
if 'help' in subj or 'urgent' in subj or 'asap' in subj:
return True
немного более понятная чем такая:
if subj.find('help') != -1 or subj.find('urgent') != -1 or subj.find('asap') != -1:
return True
More
I think those two functions have something in common :)
Line 3: I think you don't need function list here
More
line2: if you change -1 to 1 it will work anyway. Do you know why?
More
good, except you don't need square brackets in sum. So you work with generator instead of list comprehension
More
I've just found out that definition of `str.count` is different than `list.count`
>>> help(list.count)
count(...)
L.count(value) -> integer -- return number of occurrences of value
>>> help(str.count)
count(...)
S.count(sub[, start[, end]]) -> int
More
Thank you @veky, this is something new for me today
https://docs.python.org/3/library/contextlib.html#contextlib.suppress
More
The % does two things, depending on its arguments. In this case, it acts as the modulo operator, meaning when its arguments are numbers, it divides the first by the second and returns the remainder. `34 % 10 == 4` since 34 divided by 10 is three, with a remainder of four.
More
Супер!
Только не стесняйся использовать более осмысленные имена переменных. Тогда код будет чуть легче читаем
* vowels
* consonants
* words
More
I think I saw something like this already, but instead of your like 6 it was replace expression.
More