13
Last seen 1 year ago
Member for 10 years, 2 months, 14 days
Difficulty Normal
I like this logic. Either the word has all vowels stepping by 2 and all consonants stepping by 2 (one position shifted), or the inverse. Great approach.
More
I like your sorted(dictionary, reverse) trick. When i made my elements dictionary, it unsorted everything. But your semantics puts them back into order. I'm going to borrow that trick.
More
this idiom is common when parsing dictionaries --
"for k, v in my_dict.items()" --
for increasing readability, making variable name more explicit.
Your code would become:
return [
sorted([name for name, age in sailors.items() if age < 20 or age > 40]),
sorted([name for name, ag
More
It's a straightforward explanation. My hangup was interpreting how the { got saved as a 0, then the 0 compared to the }. A short comment would have clued me right in. Otherwise, i like the flow of ideas & readability.
More
I like the 'all(...) for j in range' loop within the 'for i in range' loop. I'm going to have to borrow that little trick. :)
More
From some quick googling, i've only found ^ (i.e., disjunction) can be used on comparing objects if they are in sets. So set_a = {'cat', 'fish'}, set_b = {'fish', 'stick'}, and (set_a ^ set_b) = {'cat', 'stick'}.
When used on anything else, it reads the n and m in (n^m) into binary form when tes
More
This is the most pythonic script i can imagine. In one line it converts to lowercase, eliminates non-alphebetics and sorts. The other parts are equally concise and legible.
More