57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 11 hours ago
Member for 11 years, 6 months, 24 days
Difficulty Advanced
We shall not cease from exploration, and the end of all our exploring will be to arrive where we started and know the place for the first time.
Lines 22~31 are a crime against humanity. Or at least they should be. ;-P
size = sum(1 + c.isupper() + c.isdigit() for c in text)
More
* Note the smiley at the end of line 1. ;-)
* Find how many Python keywords are in the essay. ;-)
* What's the connection between 73 and CheckiO (for old ones here;)?
More
... except if array is empty, then it cannot. ;-D
More
Instead of lambda with \*, you can use `operator.mul`. Or if you don't want to import one module more, you can use `int.__mul__`.
int(z) is duplicated, since this is the reverse of usual listcomp paradigm: you need map first, then filter over that. So you can use the building blocks directly.
More
Line 18 is wrong. rounded gamma is _not_ necessarily equal to 180 - rounded alpha - rounded beta.
BTW why do you reinvent the wheel (in this case, builtin round function)?
More
First, line 5 is
if not array:
Second, sum is a builtin. You don't have to maintain it manually.
Third, indexing from range is just a slice. array[::2].
More
Lines 20~23 are really just one line. Hint: min.
Please don't print(str(corn) + " corn is left"). Do
print(corn, "corn is left")
print is smart enough to strify automatically, and even to put a space between. ;-)
Lines 2~3:
pigeons = minute = 1
More
Line 25 is head-scratching. Sometimes comprehension is the best option.
edges = {(s[:2], s[2:]) for s in segments}
By the same token, len(tuple(filter(lambda c: counts[c] % 2, counts))) is
len([c for c in counts if counts[c]%2])
or even better
sum(v%2 for v in counts.values())
iter
More
numstring is semantically empty, str(number) says the same thing in a clearer way.
You could even iterate
for digit in map(int, str(number)):
You don't need != 0 in line 7:
if digit:
answer *= digit
More
... Universe, and everything.
Who has actually run this and expected to see 54? :-D
More
You don't need to import date. ;-)
You can just say timedelta(1).
diff is a strange name for what you're really calculating.
"in {5, 6}" is probably nicer than "in [5, 6]". Or just > 4. :-)
Line 4 is O_O. :-P
More
You don't need (object) in line 1.
Initializing of self.corner_dict is really strange. Why not just return a dict literal?
repr can be much clearer with {0.s}, {0.w} and so on, .format(self).
comments above methods really should be docstrings.
volume can reuse area calculation.
More
Yes, this is much nicer.
That ugly last line indexing, it could have been just d[max(d)], right? :-)
More
You're reinventing [the wheel](https://docs.python.org/3.9/library/heapq.html#heapq.nlargest).
More
Of course, sys.maxunicode would be much more clear, if only CiO weren't so paranoid. :-P
More
yes, it's nive that in absence of zeros, two first ducks are in fact the same. 🦆😅
More
'ddott' cracked me up. :-D
But really, is this supposed to be in the "clear" category? :-]
Also:
for callback in d.values(): time = callback(time)
More
angles really could have been a list of dicts, not of tuples. At least namedtuples. angles[1][0] just seems incredibly unpythonic to me. :-)
And you could have imported radians from math, it would help readability of your radians function. 648000 is a really magic number, it only reminds me of "648
More