21
spoty
6 23 37
2436/ 2695
Last seen 1 year ago
Member for 10 years, 6 months, 18 days
Difficulty Normal
Best reviews / Newest reviews
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
Ordered-veky 2 1
Yep nice again, I'm getting inspired by you more and more :) More
Third-gyahun_dash 2 1
'\D+ \D+ \D+' it's shorter :) More
Quadratic-Sim0000 1 1
quite rare solution, but nice one. More
Simple-sumeet.lintel 1 1
I like it, simple, but still witty. Just a golf tip. You can convert number to string like this: `n` 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
Tribute to @veky-z00sts 1 1
Thank's to Michael Hudson we have from python 1.4 - Extended Slices. You can do: >>> l = range(10) >>> l[::2] [0, 2, 4, 6, 8] More
oneLiner-tarikki 1 1
Hello stranger, list(str(.. is redundant. you can do this: return bin(number).count('1') 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
deque-spoty 1
I tried to use enumerate, but it didn't work. Because of that, I found this from Raymond, I think it can be helpful for somebody: > Lists are unique in the way they allow mutation during iteration because indexed lookup allows for a meaningful definition of what should be done as the list mutat More
Deceptive-veky 1
Yes Deceptive, indeed! Nicely used Counter(). 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-radekj
tip: return max(args) - min(args) if args else 0 More
Absolute Sorting-MadCow234
Hello stranger, key=abs is sufficient. 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-ahmedengu
When you want to use range(len(... think if you can't use enumerate(... instead. More
First-yama_k_1101 1
Faster and less memory consuming is to use generator, it didn’t have to store the entire list. return sum(1 for w in words if text.lower().find(w) != -1) aslo is IMHO better to use as condition if w in text.lower() 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-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-szczur
instead of result=int(n)*result you can write result *= int(n) More
1
2 3