21
spoty
6 23 37
2436/ 2695
Last seen 1 year ago
Member for 10 years, 7 months
Difficulty Normal
Best reviews / Newest reviews
iter-blabaster 1
This is great solution! Can you explain why are you using underscore here: [_] for _ in str(key)] More
First-sachiichi
OK, but why the h*** in the clear section? :) More
First-latteye
if i == 0 and l == 0 is same as if i == l == 0 More
3Flags-donBit
OK, one for loop is enough: for sym in data: if sym.isdigit(): digit = True if sym.isupper(): upper = True if sym.islower(): lower = True More
First-nkapliev 1
Passing generic exceptions silently is bad practice. You can wrtie something like this instead: return max(args) - min(args) if args else 0 or return len(args) and max(args) - min(args) More
First-nkapliev 1
Hello nkapliev, at first we have isupper() at second [ ] are redundant you can use generator instead return ''.join(l for l in t if l.isupper()) to read more about Iterables vs. Iterators vs. Generators I recommend to read [this](http://nvie.com/posts/iterators-vs-generators/) and also [ More
good, but no comments-Bird
You can replace code on lines 2 - 8 with this: from collections import Counter letter_dict = Counter(text.lower()) More
First-fedor-chervinskii
You can also write: return (s[n//2-1]+s[n//2])/2 if n % 2 == 0 else s[n//2] More
First-vadim.latypov
line 16 is redundant, you could do just return s More
set-gyahun_dash 3 1
super() super :) it makes me to re-read great article from [Raymond Hettinger](https://rhettinger.wordpress.com/2011/05/26/super-considered-super/) More
First-fat_neuron
You can rewrite __repr__ like this: def __repr__(self): return "Building({0.south}, {0.west}, {0.width_WE}, {0.width_NS}, {0.height})".format(self) More
First lambda-denisbalyko
you can use **&** for intersection checkio = lambda first, second: ",".join(sorted(set(first.split(",")) & set(second.split(",")))) More
Absolute Sorting-MadCow234
Hello stranger, key=abs is sufficient. More
oneLiner-tarikki 1 1
Hello stranger, list(str(.. is redundant. you can do this: return bin(number).count('1') More
First-PsnDth 1
You can call from string import digits, ascii_lowercase and then, in stead of writing your alpha, you can use: digits + ascii_lowercase More
First-Eldin 1 1
it's unnecessary (ok I know it's kinda style question) to import everything from string to namespace. from string import ascii_lowercase and also we can use generator here return min(x in text.lower() for x in ascii_lowercase) More
First-Fyodor_Morozov 1 1
There is a nice trick, how to [unpack](http://hangar.runway7.net/python/packing-unpacking-arguments) arguments in python. More
First-randers
Hello stranger, if condition: return True else: return False is same as: return condition and one more, str has [endswith](https://docs.python.org/2/library/stdtypes.html#str.endswith) More
First-WpoZoo 1
or with generator: count_inversion = lambda nums: sum(1 for i in combinations(list(nums), 2) if i[0] > i[1]) More
First-szczur
instead of result=int(n)*result you can write result *= int(n) More
1
2 3