20
r.bathoorn
3 17 37
2229/ 2445
Ronnie Bathoorn
Last seen 2 years ago
Member for 4 years, 4 months, 4 days
Difficulty Normal
Best reviews / Newest reviews
First-bravebug 2
using list comprehension you can create the outer array as follows out_array = [item for item in first_array if word in second_array] that does exactly the same as: out_array = [] for item in first_array: if item in second_array: out_array.append(item) More
Second-MBM_1607 1
nice use of defaultdict(int) to build a historgram More
Traverse tree from root-Sim0000 1
I like it below line can be left out root = roots.pop() changing line 19 to this q = deque(roots) otherwise you are justing poping the root and then putting it back in a list I created a FamilyTree class with an iterator base on your solution https://py.checkio.org/mission/wrong-fami More
C++-OrginalS 1
buf = sum(map(lambda x: VALUES[x], list(word))) is another possibility More
First-Gribanov_Dmitrij 1
nice and short way of producing all results including diagonals More
Sequential dividing-romeech 1 1
I like your solution with the deviders list! If you add empty string as the roman sign for 0 the -1 is no longer needed on the times index. Plus the "if times:" will also no longer be needed. When roman_parts is a string you can add all parts with "roman_part += roman_codes[times]" and the join at More
First-RacPotaskun 1
q, r = divmod(len(l),2) allows you to calculate the // and % at the same time so you don't have to recalculate them further down the program. then you get: l = sorted(data) half, odd = divmod(len(l),2) if odd == 1: return l[half] else: return 0.5 * (l[half - 1] + l[ More
First-Sim0000 1 2
Did they add more test cases? The solution did not work for me. It failed on the check with two fathers I had to add the following check in the tree loop: if anscestor[son]: return False # 'Can you have two fathers?' More
First-vnkvstnk
Nice and short! I feel like i cheated with len(str(a)) More
translate-r.bathoorn
since it only uses two standard python string functions i decided to put it in the clear category. For clarity i will add an explanaition to the code of what is happening. More
translate-r.bathoorn
it appears that i cannot update my solution therefore i post the explanation here Using maketrans we create a translation table where where each letter in str1 translates to a letter in str2 that is in the same spot in the string. Now string.maketrans("abc","xyz") will translate a to b, b to y and More
len-r.bathoorn
yeah, there is only so many ways you can do this :) More
rpartition-gtff
nice ad short and very readable. I didn't know about the rpartition function. thanks! More
First-antonioleeps
line 11 dispalce_time should be displace_time More
adding up timedeltas-r.bathoorn
using total_seconds() makes it simpler More
28-liner: straightforward-przemyslaw.daniel
nice way of catching the none leap years More
Ordered-veky 1
i like it, but if i see it again in 6 months i will have to spend some time to understand it again More
First-r.bathoorn
i like to build it without regex if possible it usually is easier to read. More
Chuck Norris Constant-r.bathoorn
So that would make it: sum(b"Chuck Norris Constant is greater than the sum of its parts",1) More
First-gatto_volante 1
could this be rewritten: res.append(m) res.append(int([k for k in dizio.keys() if dizio[k]==m][0]) ) res.reverse() as this? res.append(int([k for k in dizio.keys() if dizio[k]==m][0]) ) res.append(m) More
1
2