31
Cjkjvfnby
10 30 43
5274/ 5695
Andrey Solomatin
Last seen 1 year ago
Member for 11 years, 2 months, 8 days
Difficulty Normal
Best reviews / Newest reviews
Kanji-z_kro 1 1
You lambda can be replaced by function from standard library. More
sorry-oduvan 1
Looks like you never forget to put coma between strings in list :) Python parser joins string automatically. 'A' "B" == 'AB' More
First-lazzaro.mike 1
You don't need raw string in regexp, and can skip square braces when use \w You can remove **stripped** variable and return len(...) You did not care about list values, no need to make any calculation in list creation. return len([1 for word in re.findall("\w+", text) for m in (filter(w More
First-aomoriringo 1
You can rename function argument to wheat and ommit line 2. More
First-Gennady 1
It is possible implementation of that how sorted handle key argument. More
double loop-dirk86 1 1
no: **word == other\_word[-len(word):]** yes: **other\_word.endswith(word)** More
First-bukebuer 1 1
There is function in standard library that do the same as **lambda x: abs(x)** you should use it instead of this lambda. More
First-ka9e 1 1
you can use **range** function More
First-cesarkawakami 1
You can put all 3 cycles to product: for i, j (dj, di) in itertools.product(xrange(N), xrange(N), DIRS): It is bad practice then program raise exeptions during normal flow. You can replace **raise** with **continue** More
First-bryukh 1
To check if key in dict allways use **key in d**. **key in d.keys()** is less readable and huge overhead. You can use bool to convert to boolean value False if stack else True bool(stack) len(stack) == 0 More
First-raspstephan 1
Do not compare bool with True [proof link](http://google-styleguide.googlecode.com/svn/trunk/pyguide.html#True/False_evaluations) # bad if element.islower() == True: # good if element.islower(): Use len(data) instead of data.__len__(), and you can just return False More
First-idkfa32 1
same code in more functional style def checkio(data): # python 2 head, tail = data[0], data[1:] # python 3 head, *tail = data # return head + (tail and checkio(tail) or 0) More
Eval()-DoctorProk 1
use string formating it make code more readable: evalstring = '%s%s%s(%s)' % ("s", "u", "m", data) More
Second-atrioom 1
Just rename function argument no need to add new variable: def checkio(food): #food = number Be consistent use += in both cases newpigs += 1 pig += newpigs # = pig + newpigs **pig** is not good name for **pigs** More
First-tdhr 1 1
Common practice to use name **args** for arbitrary argument lists. More
First-bukebuer 1 1
Don't forget to remove debug prints. More
First-Juge_Ti 1 1
you can use .strip('[]') enstead of two replace More
First-pawlyk 1
**S**, **V** are bad variable names for python. IMHO reuse **width** and **height** variable as radius is not good, changing them to names a,c (like it common in math) will be more readable, and will fix line length for lines 12, 14 More
First-htamas 1 1
Python trick: w * w will work faster then w ** 2 More
Second-old_user 1
You can use generator expression instead list comprehansion: all(matr[x][y] == matr[x][y+i] for i in xrange(4))) and xrange(1,4), no need to compare first element. More
1 2
3
4 5 6 7 8 9 10 11 12 13 14 15