40
suic
16 39 57
9964/ 10664
Last seen 4 days ago
Member for 9 years, 10 months, 19 days
Difficulty Advanced
Best reviews / Newest reviews
list slices and string-dave_p345
Why not: if pawn1 in pawns or pawn2 in pawns: safe_pawns +=1 or even: safe_pawns += pawn1 in pawns or pawn2 in pawns ? More
First-Methode
You can write: nbSecure += angelLeft in pawns or angelRight in pawns instead of: if angelLeft in pawns or angelRight in pawns: nbSecure += 1 More
First-Olivie
I like this solution. A few comments/pieces of advice how to make it shorter: 1. print( r ) at the end is superfluous as it's never reached as there is a return statement before it. 2. you don't need to put r in brackets in the return statement _return r_ is the same in this case. 3. you can use r More
Verify Anagrams-Bassmaster
You could write: return first_letters == second_letters instead of: if first_letters == second_letters: return True else: return False More
First-tnoda
Small thing: This is a good example where you can use lambda instead of nested def. More
First-Reloader
This is a bit "noisy": One of the _for_ s is superfluous. With (e. g. list) comprehension and using all() you can reduce the remaining _for_ and _return_ to one line. More
First-veil
You can avoid the duplication on lines 15 and 16. E. g.: a_1, a_2 = (round(math.degrees(math.asin(height/lengths[i]))) for i in (0, 1)) More
First-chrisblazier
Hi, as __str__ is immutable is not a good type for accumulating values. Look at _filter()_. More
First-chrisblazier
Hi, lines 2-5 are useless and you don't need `my_string` and `my_new_string`: return "".join(phrases).replace("right", "left") More
First-StereoCat 1
Hi, 1. Last if is redundant. `return count == 26` is enough. 2. __str__ is iterable so `list(string.ascii_lowercase)` is redundant. 3. You don't need to check all lowercase letter. If any of them is not in `text` result is False. for i in string.ascii_lowercase: if i not in text: More
arithmetic and assign-Arandomusername 1
Hi, it's a bit repetitive. I played with it. Result is [here](http://www.checkio.org/mission/roman-numerals/publications/suic/python-3/arandomusernames-refactored/). More
Without import-Arandomusername 1
Hi, 1. For the left side you could use _filter()_: set(filter(str.isalpha, text.lower())) 2. For the right side you could use _set()_, _map()_, _range()_ and _chr()_: set(map(chr, range(97, 123))) 3. In fact you don't need the right-hand side: return len(set(filter(str.isa More
First-fourat05
This code is a good candidate for refactoring. Look at the _cos = ..._ and _angles ..._ lines (5 - 10). There's exactly the same pattern 3 times. Consider to create a separate function at least for _cos = ..._ lines. More
First-ryosms
A few comments: 1. In fact lines 5-7 are superfluous as a, b and c don't have to be sorted. 2. Then: a, b, c = length is the same as a = length[0] b = length[1] c = length[2] 3. Consider creating a separate function from: round(degrees(acos((b * b + c * c - a * a) More
Second-ultrajack
Good job! There's no redundancy. And it's even safer than it has to be, as all inputs in the tests are already sorted :) More
First-Plazer
You don't have to use third variable two swap values of two variables. You can simply write: if n < m: m, n = n, m instead of: if n < m: tmp = n n = m m = tmp More
First - The Hamming Distance-AQiccl135 1
You can use the [str.rjust](https://docs.python.org/3/library/stdtypes.html?highlight=str.rjust#str.rjust) method for this: fill = abs(len(n) - len(m))*'0' if len(n) < len(m): n = fill + n else: m = fill + m More
using "bitwise exclusive or"-johnhaines
Why not return bin(n ^ m).count("1") ? More
First-tkm-tyler
In this case you can use _int_ instead of _lambda c: int ( c )_. More
First-subaru
_nbin_ and _mbin_ are both _str_ which is iterable there for using list() in lines 10 and 11 is superfluous. And also you can write: size = max(len(nbin), len(mbin)) More