19
Last seen 9 months ago
Member for 3 years, 9 months, 11 days
Difficulty Normal
PhD in Geosciences/Economics working on agent-based models for public policy in python. Also a pantser independent writer at https://www.amazon.com/Linger-Longer-Diana-runner-helper-ebook/dp/B08D6WQHG9
Excellent use of count(). Alternatively, we know True is 1 and False is 0, it might come in handy. Also, some PEP (I don't remember) suggest spaces between operators (space > space)
More
Great job (reviewing for a quest)!
If you wish to simplify the code, you could:
(a) eliminate the 0 at the beginning of range and
(b) test for different, return False, at the end return True
as such: Best
def checkio(matrix):
for i in range(len(matrix)):
for j in range(len(matrix[i])):
More
Great job! You could have gone directly
return items.count(True) > items.count(False)
I guess...
More
# Reviewing follower for quest.
Excellent job on a couple of one-liners and double list comprehension.
When copying (and running) on PyCharm, what I got (and always obey) is suggestions for a one extra line before function, no extra space between ')' and ']' (line 16), one extra line before if __nam
More
Another excellent job. I would personally add the extra lines (sorry, same quest, same comments). The space between hours,minutes, for example look really nice for me. BEst
More
Hi,
Reviewing for a quest. I did pretty much like you, except I used Counter.
The only suggestion I can see is to provide spaces after commas and two
spaces before functions. It does clearer the code.
Congrats
More
Hi Omarbd,
Reviewing a follower for a quest.
Great answer, I wouldn't know how to improve it. Good use of str.find. Congrats
More
I found this one a bit convoluted. What about my alternative?
def split_pairs(a):
if not a:
return []
if not len(a) % 2 == 0:
a += '_'
return [a[i] + a[i + 1] for i in range(len(a)) if i % 2 == 0]
More
Good use of lambda. I just did not get the need to rotate. Also not sure if
return [0, 0, 0] works all positions of arguments... I'll have to practice
further ;)
More
Mine was also that long, and also documented. But, when I saw the other answers, wow. Much shorter and much better... I reasoned like you. The others mostly used itertools.product for all combinations and filtered out based on data. Learning. Learning. Thanks.
More
Neste caso, o else: continue é desnecessário, porque o loop continua quando i é falso...
More
How does it really work. I did not get it. Also, it did not pass the empty assertion because it checks against a tuple, not a list. Thanks.
More