22
DahliaSR
7 23 46
2682/ 2945
Dahlia Ramm
Last seen 1 year ago
Member for 8 years, 1 month, 3 days
Difficulty Normal
Best reviews / Newest reviews
key=abs-vikulin
Nice, I did it exactly the same way! More
First-alexmon1989
Nice one! Why are u using _**key=lambda x: abs(x)**_ instead of _**key=abs**_ ? Instead of casting "numbers_array" to a list, i guess udid this to use list.sort(), u could have used the bult-in function sorted(). sorted() also takes key functions **and** it can deal with any iterable as it returns More
Recursive-rperki8
Line 2: if not len(data): return 0 Calling len(data) is unnecessary! if not data: return 0 does the same, and follows PEP8. More
First-basketbal44champ
Line 3: n = str(bin(num))[2:] bin() already returns a string, so there is no need to cast it! Slicing away "0b" also makes no sence as it never effects the result. Instead of using a for-loop to count the unities, you could return n.count("1") More
First-sebsch
Why are u doing this? > list(zip(*data)) already returns the transposed matrix as a 2D-List. More
First-sk7
Straight logic, easy to understand at first sight! This IS Clear! More
first fizzbuzz-phyrenight
Line 6: if (number%5) == 0 and (number%3) == 0: the least common multiple of 2 and 5 is 15, so: if number & 15 == 0: will give the correct result with less code. The "elif" in line 8 and 10 should be "if", because if the expression before evaluates to true they will never be reached. Lin More
switch-case-bryukh 1
I like it, even though its a bit complicated. But I had no idea that's it possible to use tuple as index for dictionary... learned something. More
First-flyingmonkey132
Nice! But in line 10: fib_seq = fibo(20) you are generating the first 20 fibonacci numbers, that's more you ever need Ge.nerating the next Fibonacci number only if you need it makes more sense. More
First-dasich12
You are generating more fibonacci numbers then you might need, I think it makes more sense to only generate the next fibonacci number it there is need to do so. Is a dictionary the proper type to store your result? The older the ghost gets, the more kv pairs are in your dict, even thoungh will only More
First-DahliaSR
What's bad about this solution? When the ghosts age is 55 the while-loop will be executed 55 times... When the ghosts age is 4689 the while-loop will be executed 4689 times... Needs a second try... More
First-sedoy80 1
Line 5: if b >= 3: Can b ever become > 3? More
1-Vladyslav 1
Line 2: ... lambda numbers_array: numbers_array if (numbers_array > 0) else -numbers_array)... Have a look at the [built-in function abs()](https://docs.python.org/3.6/library/functions.html#abs). ;) More
"Non-unique Elements" / SevenDayEngineer-sevendayengineer 1
Line 5: counted = data.count(i) # count the number of occurences of unique item How often can a **unique** number occur? More
First-dzon4xx
return bin(number)[2:].count('1') You are slicing away the first 2 chracters of the string bin(number) returns. Is that necessary? will one of these character ever be "1"? More
numpy.bitwise_xor-greg.p.mueller 1
Is the numpy.bitwise_xor() more effective then the bitwise xor operator "^"? More
First: Fizz Buzz-likbjorn
Line 19: return str(answer) do you need to type cast answer to string here? Line 11: if number % 3 == 0 and number % 5 == 0: when you use the least common multiple of 3 and 5 you can get rid of the "and" comparison. if number % 15 == 0: More
First-MilfordCubicle 1
Clear! Line 6: if number % 3 == 0 and number % 5 == 0: what about the least common multiple of 3 and 5? if number % 15 == 0: More
Dumb solution-sirajul_islam_anik 1
Line 3: if len(splitted) == 0: this "if" is redundant, len(splitted) can never be 0. Besides that if you ever want to check whether a sequence is empty or not use: if sequence: do something if the sequence is empty, this "if" evaluates to **False** otherwise to **True** Line 14 to More
First-roman80 1
Clear! Instead of type casting the tuple to a list manually you could have used the [built-in function sorted()](https://docs.python.org/3.6/library/functions.html#sorted). You can pass iterable to this function and it returns a list. More
1 2 3 4 5 6 7
8
9