57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 12 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.
Nice and complicated. :-P Wouldn't dict be more appropriate data structure for z?
More
First, if you _used_ regex here, that would be remarkable. Not using Python re here is like not using a bicycle for swimming. :-D
Second, argh. Please don't do
if c: return True
else: return False
if c binds something bool. Do
return c
Token count just went from 7 to 2. A
More
Yep, a lot more code than needed. BTW you get a Special Confusion Award for using " ".join on a str. :-D (And then .split() right after that.:)
More
A lot of people know about .format _method_, but they don't know about format _function_. It's really much nicer when you just want to format a single value.
format(m ^ n, "b")
More
First, don't test "len(args) == 0". Just test "args" (or "not args", if you want to have that order of returns). PEP8: "For sequences, (strings, lists, tuples), use the fact that empty sequences are false."
Second, why sort? min and max are linear.
More
Different operators can be chained too.
if a == b == c != '.': return a
More
Instead of .keys, try using .items:
for i, f in lettersFound.items():
Then you can write f instead of lettersFound[i] every time.
More
?? What _did_ you think float(median) does? Changes the type of a live value? :-O That's impossible even in C. ;-P
More
Lines 13-18: there is "or" keyword in Python. Might come handy. :-)
count += first<=VOWELS and second<=CONSONANTS or first<=CONSONANTS and second<=VOWELS
Also, you don't need .isalpha() at all.
More
Those conditions are really mind-bending. You seem like you're trying to find the most complicated way to say something. :-( For example, lines 37-38 are just
if "OOO" in game_result + transpose: return "O"
range(0,3,2)... wasn't it simpler to write just 0,2 ?
And why do you have _two_
More
Lines 12-15 are just
return min(feed[hour - 1], birds)
In fact, you don't even need line 11.
More
LOL. This is getting funnier and funnier. I'd understand if you where some kind of Python newbie, but you know about filter builtin, unbound methods, and collections.Counter. You're obviously not a newbie. Why do you write such convoluted code then?? I really want to know. :-)
More
Argh. Again. In one moment, you use OrderedDict. Just one line below, you write that completely unnecessary while. Dr. Jekyll and Mr. Hyde, are you? :-D
Also, if you use +=, you can use %= in line 9, too.
More
There is much easier way to implement UnionFind. Objects don't need to be listed, associative mappings are much more intuitive. ;-)
More