16
Last seen 1 year ago
Member for 8 years, 3 months, 10 days
Difficulty Normal
what do you think about change name of predicates to more specific like
c1 = len(password) >= 6
len_ge_6 = len(password) >= 6
More
I didn't know that title separates words with any non-alphabetic characters
print('test test_test test5test'.title())
Test Test_Test Test5Test
[Documentations on str.title](https://docs.python.org/3/library/stdtypes.html#str.title)
And there is the important precondition "Input data w
More
The good solution based on the fact that instructions can be processed in any order.
More
Are the states generated by another python program? It is interesting to look at this.
More
In this task i understand that to rotate matrix need only two funcions:
grille=["".join(c[::-1]) for c in zip(*grille)]
grille = tuple(zip(*reversed(grille)))
More
This solution is understandable, but it has one drawback: it builds a whole list. In python it is more convenient and faster to use a generator (example, yield), the second advantage is that you don't need a variable to collect the result (r in this code).
More
Interesting solution! I tried to change line 7 and it's work
res.append(i[-1]) if "PUSH" in i else i == "POP" and res and res.pop(0)
More
I think it could be little more readable if you change lines 4 and 5
if (c == "POP"): ans = ans[1:]
else: ans = ans + c[-1]
More
This approach was described in Python [Sorting HOWTO](https://docs.python.org/3/howto/sorting.html#sort-stability-and-complex-sorts) documentation.
More
True and False is converted to a list index consisting of True and False :)
More
Usually, for with items more useful than for with range
for i in range(len(array)):
for element in array:
it doesn't need indexes.
More
function is_even can be simpler
return num % 2 == 0
More
This solution needs to user slice two times. I think it's better to iterate over indexes of string and make one slice.
More
We split words from text and go through them. If we match word from text and word from list we increment index word from the list. At the end if index equivalent length of the list of words we know that text contains all of words from list in same order.
More