22
DahliaSR
7 23 46
2682/ 2945
Dahlia Ramm
Last seen 1 year ago
Member for 8 years, 19 days
Difficulty Normal
Best reviews / Newest reviews
Say Hi-svartmetall 3 1
Nice! +2 for using an f-string. More
6502 like pseudo assembly-Tinus_Trotyl 2 2
Very complicated and lots of redundant expressions. - Line 12: a = n What for? You are not reusing the original value of _n_ anywhere, so why do need a copy of it? - Line 16: a, c = a//2, a%2 using _divmod()_ is shorter and clearer... a, c = divmod(a, 2) - Line 17 to 18: More
Enum-veky 2 1
Maybe a bit too much for this task **but** a great example on what is possible. This also is the best approach if you ever want to decode a roman numeral to decimal rep. Just add decode method and your're done. Great! More
Compilation-veky 2 1
Damn... I added a boundary to my regex-pattern for no reason. More
What's up, __doc__?-veky 2 1
Cheater! The taks asked you to **calculate** the return value and not to look it up in a table. :D More
abc-dev0611 2
Hm... Correct idea but you haven't thought it to the end. Your `add_food` and `add_drink` methods are **exactly** the same in all the concrete classes, so why do have to enforce yourself to override them in each subclass? And your `total` method doesn't need an override too. You could simply use More
First-__________________789 2 1
Wow, this one is scary! + the readability of this is bad while True: if flist[len(flist)-1] > 5000: break else: flist.append(flist[len(flist)-1]+flist[len(flist)-2]) what about this? while flist[-1] < 5000: flist.append(flist[-1] + flist[-2]) + You are More
Spot the difference!-veky 2 1
Whoo, took me some minutes to figure out how the lamdba works here (thanks to Pythontutor :D) Really cool! More
itertools.groupby-flpo 2 3
@veky once argued with me, because I was mapping a lambda. He explained that this is a LISPsm!!! I don't see why using a LISPsm is bad, by **I do agree** that mapping a lambda is not good when an generator expression can do the job: max( (len(list(v)) for k, v in groupby(line), default= More
Simple-Pouf 1 1
Calling _filter_, which calls a lambda, which calls _bin()_... Why not an if statement in the generator? ''.join(chr(c>>1) for c in message if not bin(b).count('1') & 1 More
First-delta.varphi 1
I would recommend to get rid of line 2 and change line 4 to: for i in words.split() this saves a line of code. Be careful when using str.split(" ") instead of str.split(). More
First-Vereena 1
Turning _data_ into a _set_ would prevent from repeatedly counting equal elements. More
The Most Frequent-wojtask98 1 1
Never use blank excepts, always make sure to catch specific exceptions instead of all exceptions. except KeyError: elements[element] = 1 But in this case it's even better to prevent the raising of KeyErrors, by using _dict.fromkeys()_. # this guarantees that any string from data More
First-Jaybreez17 1 1
Clear! You can improve your solution by apllying the [EAFP coding style](https://docs.python.org/3/glossary.html#term-eafp). This means that, instead of explicitly checking if _n_ is a valid index for _array_ you simply assume that it is and in case an Error is raised you catch it... try: More
First-DeCooper 1
Nice use of the std libs. Could even be simplified to: from statistics import mode as most_frequent :D More
smn theorem-veky 1 1
Learned something new - again! If I got it wright, using functools.partial() makes most sense if you are actually planning to reuse the partial object? More
First-Sim0000 1
Straight forward! Using an f-string would be worth +2. :D More
reduce-Sim0000 1
Yes obvious, but there are two thing I don't like about it... 1. The rule **gcd(a, a) = abs(a)** makes it clear, that repeated values, DO NOT effect the final result. So turning _args_ into a set, decreases the number of calls to _gcd()_ 2. Another problem is that _reduce()_ keeps calling _gcd() More
Simple-brubru777 1 1
Very nice and clear. Just one small thing: Instead of using this: wall.strip().split('\n') it would be more readable and simpler to use `str.split()`: wall.strip().split('\n') By default `str.split()` splits at any whitespace character and treats consecutive whitespace characters as a s More
transpose with map and zip, then loop-DeCooper 1 1
Line 2: sections = list(map(list, zip(*wall.split()))) # -> string into transposed list If you change this to: sections = list(zip(*wall.split()) # -> string into transposed list The least one is shorter and easier. You will get a list of tuples instead a list of lists, but since tuple More
1
2 3 4 5 6 7 8 9