57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 23 hours ago
Member for 11 years, 6 months, 6 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.
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
Ah, distributivity: the cute way to write
' ' * (by + (index < to))
with only one pair of parentheses. :-D
More
And you'd get double the points if you got rid of the pointless
duplication. :-P
More
This is a nice place to teach you about *-calls.
First, i+j\*1j is complex(i,j). That is not so exciting. But if a=(b,c), complex(b,c) can be written as complex(\*a). In your case, since len(a)==3, complex(\*a[:2]) would do the job. Functions can take their (last) arguments from any sequence, for
More
An obvious solution. Just a few hints:
frozenset([int(s[0]),int(s[1])]) is frozenset(map(int,s)).
frozenset([n,i]) (better written as frozenset({n,i})) really ought to be assigned to a variable, it's used in lines 8, 9 and 13.
BTW instead of closing over ts and manually screwing it into pla
More
Argh, float("%.2f" % x)... you really should use the function "round". ;-)
More
LOL about that "-1" in line 8... isn't it more clear to use slicing?
f0, f1 = map(bin(first)[2:].count, "01")
More
Cool idea, can be onelined without much problems.
checkio=c=lambda s,w=1:len(s)and max([s[0]+c(s[2:],0),s[0]+c(s[1:])]+w*[c(s[1:],0)])
Especially jarring is "whisker == True" instead of just whisker. Comparing bools to True makes as much sense as adding ints to 0. :-P
More
`set` has a much more versatile API than just "make null, add, and count elements". :-) Also, it's very nice to use `string` for `punctuation`, but whitelisting is more useful than blacklisting. See my solution.
More
Yes, it's almost what I wanted. :-) The only problem now is that you have that `i`, incremented every time, when all you really want of is to see whether it's zero---and connected to that, you have two ifs in the loop, one of which is almost always false.
More
If you're importing itertools, cycle would be much better fit than count.
More
Eta-reduction applies here: checkio = \_\_builtins\_\_['s''um']. And as you see, + is not needed. ;-)
More
It's fascinating that the same solution, somebody puts under puzzle, somebody under clear. :-P
More