57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 3 hours ago
Member for 11 years, 6 months, 8 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.
OK, but you might want to learn about sets and & (intersection) operator. Faster and cleaner than rolling your own.
More
You could have cached that range(len(D)). And "if 0 in bla" is here "if not all(bla)". ;-)
More
You can initialize all (l13~15) at once:
lower = upper = digit = 0
You can ask ints for truth directly:
return len(data) >= 10 and digit and upper and lower
More
1. You don't need to sort and extract just to find maximum. See max with key argument.
2. Lines 4~6 can just be "for letter in text.lower():". This is not C, text will be lowered only once in any case.
3. Line 8 is pretty ugly. You can use defaultdict(int), but even better, the name of a varia
More
You don't need copying in line 9.
Unpacking is much better when you use it consistently with your structure: line 6 is
row_zero, row_one, row_two = game_result
range(0,3) is range(3). Or even better, use zip(row_zero, row_one, row_two).
That "str"s everywhere are probably worse than
More
Hm, this gives me some [idea](http://www.checkio.org/mission/digit-stack/publications/veky/python-3/pointless/)s... :-]
More
About that horrible line 17, I think I have good news for you: tuple comparisons.
(a, b) < (c, d) <~~~> a < c or a == c and b < d
You can also learn about key argument to min and max.
More
First, a + a + a is really a*3, even when a is a str.
Now you know that, remove the duplication. :-]
More
"lambda i: abs(i)" has a much nicer name. It has three letters. ;-)
Google eta-reduction if you want to know more. ;-)
More
Wow, heavy artillery. :-D Even I didn't know about operator.indexOf. Really cool. :-)
More
This is not C (nor Perl), you don't need parens after while, if, ...
base += -c if isfib(c) else 1
"c = 0 # counter" is a really weird comment. If you want to call it counter, do so. You can even have two names: counter = c = 0. :-D
Calling "fib" a function that _checks_ whether somethi
More